• 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.
    image.png
    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)

    1. // Slice the third element and restrict the capacity.
    2. // Contains a length of 1 element and capacity of 2 elements.
    3. slice := source[2:3:4]

    map is implemented using a hash table
    image.png
    Simple representation of the internal structure of a map
    LOB: low order bits
    HOB: high order bits