So far you’ve worked with single values: one number, one string, one boolean. Real programs deal with collections — lists of users, maps of country codes to currencies, structured records like a customer’s address.

Go has a small set of data structures, but they cover almost every situation you’ll meet:

What’s in this section

  1. Arrays and Slices — ordered lists of values; the workhorse data structure of Go
  2. Maps — key/value lookups, like a dictionary
  3. Pointers and Structs — direct memory references and grouped fields, the foundation of every Go application

By the end of this section, you’ll be able to model most real-world data in Go.

Toggle theme (T)