We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4ce1d90 commit 641f4f5Copy full SHA for 641f4f5
internal/bpool/bpool.go
@@ -5,15 +5,16 @@ import (
5
"sync"
6
)
7
8
-var bpool sync.Pool
+var bpool = sync.Pool{
9
+ New: func() any {
10
+ return &bytes.Buffer{}
11
+ },
12
+}
13
14
// Get returns a buffer from the pool or creates a new one if
15
// the pool is empty.
16
func Get() *bytes.Buffer {
17
b := bpool.Get()
- if b == nil {
- return &bytes.Buffer{}
- }
18
return b.(*bytes.Buffer)
19
}
20
0 commit comments