liveBook · Manning

Make

make is a Go built-in function that initializes slices, maps, or channels, optionally specifying size or capacity.

How 2 Manning books explain it

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
Initializes Go slices, maps, and channels for collection storage or communication between goroutines.
How deep it goes
Explains slice backing arrays and capacity constraints, map initialization, and channel creation through usage examples.
Examples
Uses preallocated integer slices, integer-to-string maps, and channels for fetching and saving feed articles.
What you can do after
Apply make to initialize collections and create channels, choosing slice capacity for anticipated growth and avoiding nil-map assignment panics.

Read how Go in Action, Second Edition explains make →

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 →

What to know first

Related concepts

Questions about make

What is make?

make is a Go built-in function that initializes slices, maps, or channels, optionally specifying size or capacity.

Which Manning books explain make?

Go in Action, Second Edition and Learn Go with Pocket-Sized Projects.

What should I know before learning make?

Manning books that teach make usually introduce goroutine and slicing first.

What is the difference between make and map literal?

make is a Go built-in function that initializes slices, maps, or channels, optionally specifying size or capacity. A map literal is Go syntax that creates a map value by specifying its key and element types and optionally initializing entries.

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.