I'm trying to clear a bytes.Buffer
, but there's no such function in the document
Maybe I should just renew the buffer? What's the right way to do it?
buffer = bytes.NewBufferString("")
buffer.Grow (30000)
func (*Buffer) Reset
func (b *Buffer) Reset()
Reset resets the buffer so it has no content. b.Reset() is the same as b.Truncate(0).
func (*Buffer) Truncate
func (b *Buffer) Truncate(n int)
Truncate discards all but the first n unread bytes from the buffer. It panics if n is negative or greater than the length of the buffer.
buffer.Reset()