A slice describes part of an underlying array. Its length controls which indexes are valid; capacity controls how far it can grow without another allocation. Appending returns a slice, so keep that returned value. A slice with no elements may be nil or allocated with length zero. Both have length zero, but they differ when encoded or compared with reflection, and a function contract can choose one representation. The tasks here ask for allocated empty results when no records match. You will also choose a prefix without reading past the end. Bounds mistakes are real Go panics in this editor. Fix the input rule instead of catching the panic, and check a zero-length slice before indexing it.
Only positive values remain.