package main import "fmt" // the slice header is copied, but it points at the same array func zeroFirst(v []int) { v[0] = 0 } func main() { nums := []int{1, 2, 3} zeroFirst(nums) fmt.Println(nums) // [0 2 3] }
the callee's writes are visible