We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent af8987b commit 44748b8Copy full SHA for 44748b8
pool/buffer_test.go
@@ -173,18 +173,19 @@ func TestPool_Put(t *testing.T) {
173
174
p.Put(b)
175
176
+ var bb *bytes.Buffer
177
// 开启 race 时有一定概率导致 Put 被丢弃
178
pp := (*sync.Pool)(p)
179
for i := 0; i < 10; i++ {
- b = pp.Get().(*bytes.Buffer)
180
- if b.String() == "xx" {
+ bb = pp.Get().(*bytes.Buffer)
181
+ if bb.String() == "xx" {
182
break
183
}
184
185
186
187
- if b.String() != "xx" {
188
- t.Errorf("b1.String():%s != xx", b.String())
+ if bb.String() != "xx" {
189
+ t.Errorf("b1.String():%s != xx", bb.String())
190
191
0 commit comments