package rep import ( "bytes" "sync" ) var bufPool = sync.Pool{ New: func() any { return &bytes.Buffer{} }, } func bufPoolGet() *bytes.Buffer { return bufPool.Get().(*bytes.Buffer) } func bufPoolPut(b *bytes.Buffer) { b.Reset() bufPool.Put(b) }