Append inside a function can be tricky:
func addOne(s []int) {
s = append(s, 1) // Doesn't affect caller
}
The append might create a new array. The caller's slice still points to the old one. Return the new slice or pass a pointer to the slice.