Len returns the number of bytes of the unread portion of the buffer; b.Len() == len(b.Bytes()).
package main import ( "bytes" "fmt" ) func main() { var b bytes.Buffer b.Grow(64) b.Write([]byte("abcde")) fmt.Printf("%d", b.Len()) }