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 <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
diff --git a/slog/internal/buffer/buffer_test.go b/slog/internal/buffer/buffer_test.go
index fc64429..4466140 100644
--- a/slog/internal/buffer/buffer_test.go
+++ b/slog/internal/buffer/buffer_test.go
@@ -18,14 +18,3 @@
 		t.Errorf("got %q, want %q", got, want)
 	}
 }
-
-func TestAlloc(t *testing.T) {
-	got := int(testing.AllocsPerRun(5, func() {
-		b := New()
-		defer b.Free()
-		b.WriteString("not 1K worth of bytes")
-	}))
-	if got != 0 {
-		t.Errorf("got %d allocs, want 0", got)
-	}
-}
diff --git a/slog/internal/buffer/norace_test.go b/slog/internal/buffer/norace_test.go
new file mode 100644
index 0000000..c73ef8a
--- /dev/null
+++ b/slog/internal/buffer/norace_test.go
@@ -0,0 +1,20 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !race
+
+package buffer
+
+import "testing"
+
+func TestAlloc(t *testing.T) {
+	got := int(testing.AllocsPerRun(5, func() {
+		b := New()
+		defer b.Free()
+		b.WriteString("not 1K worth of bytes")
+	}))
+	if got != 0 {
+		t.Errorf("got %d allocs, want 0", got)
+	}
+}