Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions internal/bpool/bpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Loading