bytes.Buffer, I thought you were my friend
Phil Pearl
595

It may be worth looking at the Reset method on bytes.Buffer.

In those benchmarks, I get these results:

BenchmarkStringPlus-8 20000000 64.3 ns/op 32 B/op 1 allocs/op
BenchmarkByteBufReset-8 20000000 90.3 ns/op 32 B/op 1 allocs/op

While the + method is faster, bytes.Buffer is more flexible, and you’re not incurring huge allocation overhead with it if you use Reset.