Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit641f4f5

Browse files
authored
internal/bpool: add New function (#465)
Signed-off-by: bestgopher <84328409@qq.com>
1 parent4ce1d90 commit641f4f5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎internal/bpool/bpool.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import (
55
"sync"
66
)
77

8-
varbpool sync.Pool
8+
varbpool= sync.Pool{
9+
New:func()any {
10+
return&bytes.Buffer{}
11+
},
12+
}
913

1014
// Get returns a buffer from the pool or creates a new one if
1115
// the pool is empty.
1216
funcGet()*bytes.Buffer {
1317
b:=bpool.Get()
14-
ifb==nil {
15-
return&bytes.Buffer{}
16-
}
1718
returnb.(*bytes.Buffer)
1819
}
1920

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp