GoGo · Lesson 5 of 8
Slices & Maps
Go's two primary collection types. Slices are dynamic arrays. Maps are hash tables. Together they cover nearly everything.
⚠ Warning
Slices are reference types — assigning a slice to another variable does not copy the data; both point to the same underlying array. Use copy() or append([]int{}, src...) to make an independent copy.
Slices are reference types — assigning a slice to another variable does not copy the data; both point to the same underlying array. Use copy() or append([]int{}, src...) to make an independent copy.