title: InvalidCap layout: article
InvalidCap occurs when an argument to the cap built-in function is not of
supported type.
See https://golang.org/ref/spec#Length_and_capacity for information on
which underlying types are supported as arguments to cap and len.
Example:
var s = 2
var x = cap(s)