Skip to content

Commit b168a2c

Browse files
committed
slog/internal/buffer: don't run alloc test with race detector
Fixes golang/go#54978. Change-Id: I42d1f952e7f9f8469f640763fc3363d087583918 Reviewed-on: https://go-review.googlesource.com/c/exp/+/431056 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]>
1 parent 840b380 commit b168a2c

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

slog/internal/buffer/buffer_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,3 @@ func Test(t *testing.T) {
1818
t.Errorf("got %q, want %q", got, want)
1919
}
2020
}
21-
22-
func TestAlloc(t *testing.T) {
23-
got := int(testing.AllocsPerRun(5, func() {
24-
b := New()
25-
defer b.Free()
26-
b.WriteString("not 1K worth of bytes")
27-
}))
28-
if got != 0 {
29-
t.Errorf("got %d allocs, want 0", got)
30-
}
31-
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2022 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build !race
6+
7+
package buffer
8+
9+
import "testing"
10+
11+
func TestAlloc(t *testing.T) {
12+
got := int(testing.AllocsPerRun(5, func() {
13+
b := New()
14+
defer b.Free()
15+
b.WriteString("not 1K worth of bytes")
16+
}))
17+
if got != 0 {
18+
t.Errorf("got %d allocs, want 0", got)
19+
}
20+
}

0 commit comments

Comments
 (0)