- Array internals and fundamentals
- Managing collections of data with slices
- Working with key/value pairs using maps
Slices are three field data structures that contain the metadata Go needs to manipulate the underlying arrays.
Slice internals with underlying array
THREE INDEX SLICES
The purpose is not to increase capacity, but to restrict the capacity.b := a[low : high : max]
0 <= low <= high <= max <= cap(a)
// Slice the third element and restrict the capacity.
// Contains a length of 1 element and capacity of 2 elements.
slice := source[2:3:4]
map is implemented using a hash table
Simple representation of the internal structure of a map
LOB: low order bits
HOB: high order bits