for i, thing := range things {
// thing is always a copy - mutating it doesn't mutate the thing in things
}
// You have to use an index if you want to mutate the element
for i := range things {
things[i].field = value
}
func update(things []thing) []thing {
things = append(things, x) // Copy
return things
}
go build -gcflags -m=2 to see the results of escape analysis