29
Appending to a slice I passed to a function changed the caller's data — I thought slices were passed by value
I have a function that takes a slice, appends a couple of elements and returns the result. The caller keeps its own slice and uses the returned one separately. Sometimes the caller's original slice has changed…