(*bytes.Buffer).Reset
instead GO-R1003Truncate discards all but the first n
unread
bytes from the buffer but continues to use the same allocated storage. If n
is 0, i.e.,
argument to Truncate, it is the same as Reset that
resets the buffer to empty, and the latter is considered more idiomatic.
buf := &bytes.Buffer{}
// do some work
buf.Truncate(0)
buf := &bytes.Buffer{}
// do some work
buf.Reset()