Make
make is a Go built-in function that initializes slices, maps, or channels, optionally specifying size or capacity.
Go in Action, Second Edition
make is a Go built-in function that allocates and initializes slices, maps, or channels with a specified type and size parameters.
- How it is used
- Creates usable slices, maps, and channels for collection growth, map assignment, and goroutine communication.
- How deep it goes
- Explains slice length, capacity, zero values, and backing storage; contrasts map initialization and demonstrates channel creation without detailing channel internals.
- Examples
- Shows zero-filled and preallocated slices, empty maps alongside a nil-map panic, and channels carrying feed articles and errors.
- What you can do after
- Build it from scratch: initialize Go collections and channels, reserve slice capacity, and avoid assignments into nil maps.
Learn Go with Pocket-Sized Projects
make is a Go built-in function that initializes slices, maps, or channels with specified size-related parameters.
- How it is used
- Initializes maps and slices while implementing book counting and repeated-book collection.
- How deep it goes
- Explains allocation, map size hints, and slice length versus capacity, but defers deeper slice internals.
- Examples
- Demonstrates map counting, explicit map sizing, indexed slices, reserved capacity, and appending repeated books.
- What you can do after
- Build it from scratch by choosing map size hints and slice length or capacity for collection-based functions.
Read how Learn Go with Pocket-Sized Projects explains make →
Related concepts
- Mapuses · A map is an associative data structure that stores key-value pairs and supports retrieving values by key.
- capacityconfigured by · Capacity is the maximum amount of resources, workload, or contents that a system, structure, or process can accommodate or handle under specified constraints.
- slicingproduces · Slicing selects or partitions a portion of an indexed sequence or multidimensional array, often along specified indices or dimensions.
- channelproduces · A channel is a typed Go communication and synchronization mechanism through which goroutines send and receive values.
- zero valueproduces · A zero value is the default, type-dependent value assigned when a variable, field, or newly allocated value has no explicit initial value.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

