The bytes.Buffer
object has a Truncate(n int)
method to discard all but the first n
bytes.
I'd need the exact inverse of that - keeping the last n
bytes.
I could do the following
b := buf.Bytes()
buf.Reset()
buf.Write(b[offset:])
but I'm not sure if this will re-use the slice efficiently.
Are there better options?