diff --git a/internal/bpool/bpool.go b/internal/bpool/bpool.go index aa826fba2b1c8462982becbed1431a01f6acc951..12cf577a9f7a4196f77967a55febeb35ffbf6235 100644 --- a/internal/bpool/bpool.go +++ b/internal/bpool/bpool.go @@ -5,15 +5,16 @@ import ( "sync" ) -var bpool sync.Pool +var bpool = sync.Pool{ + New: func() any { + return &bytes.Buffer{} + }, +} // Get returns a buffer from the pool or creates a new one if // the pool is empty. func Get() *bytes.Buffer { b := bpool.Get() - if b == nil { - return &bytes.Buffer{} - } return b.(*bytes.Buffer) }