Standard library / bytes
bytes.Buffer.Cap()
Reports total backing capacity; it may be larger than Len and is not a fixed growth guarantee. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Buffer) Cap() intReturn Value
int
Reports total backing capacity; it may be larger than Len and is not a fixed growth guarantee.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt")
func main() { var b bytes.Buffer b.Grow(8) fmt.Println(b.Cap() >= 8)}