Skip to content

Glossary: Go Beyond the Basics

cap / capacity

Also written: capacity, cap

How many elements a slice or channel has room for. `make([]int, 0, 10)` is empty but has capacity 10, and `cap` reports it.

Where the book teaches it

Related terms

makebuffered channel