Alex

Reference and Value Semantics (Video 14)

More on Copying

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
}

Stack Usage and Escaping