Package bpool is a minimal wrapper using sync.Pool for *bytes.Buffer.
package bpool_test
import (
"testing"
"github.com/johejo/bpool"
)
var pool = bpool.New()
func Example() {
buf := pool.Get()
defer pool.Put(buf)
for i := 0; i < 1024; i++ {
buf.WriteString("hello")
}
println(buf.String())
}
MIT
Mitsuo Heijo(@johejo)