Skip to content
masterclass Buddy

Go · Function

cap

cap returns a value's capacity. Its meaning depends on the type: it is the reslicing limit for a slice, the element count for an array, or the buffer size for a channel.

Last updated

Syntax

func cap(v Type) int

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • len
  • make

Source: builtin package - builtin - Go Packages. Checked 2026-11-03.