Skip to content

Instantly share code, notes, and snippets.

@quux00
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quux00/f51738442374be854031 to your computer and use it in GitHub Desktop.
Save quux00/f51738442374be854031 to your computer and use it in GitHub Desktop.
bytes.Buffer definition
type Buffer struct {
buf []byte // contents are the bytes buf[off : len(buf)]
off int // read at &buf[off], write at &buf[len(buf)]
runeBytes [utf8.UTFMax]byte // avoid allocation of slice on each WriteByte or Rune
bootstrap [64]byte // memory to hold first slice; helps small buffers avoid allocation.
lastRead readOp // last read operation, so that Unread* can work correctly.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment