Skip to content

Commit 8ef6f92

Browse files
cuonglmeric
authored andcommitted
log/slog: fix window race builder
Bench log file is created non-portably, only works on system where "/tmp" existed and "/" is path separator. Fixing this by using portable methods from std lib. Updates golang#56345 Change-Id: I1f6b6b97b913ca56a6053beca7025652618ecbf3 Reviewed-on: https://go-review.googlesource.com/c/go/+/478355 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 2d1bfcb commit 8ef6f92

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/log/slog/json_handler_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"log/slog/internal/buffer"
1515
"math"
1616
"os"
17+
"path/filepath"
1718
"strings"
1819
"testing"
1920
"time"
@@ -201,7 +202,7 @@ func BenchmarkPreformatting(b *testing.B) {
201202
}),
202203
}
203204

204-
outFile, err := os.Create("/tmp/bench.log")
205+
outFile, err := os.Create(filepath.Join(b.TempDir(), "bench.log"))
205206
if err != nil {
206207
b.Fatal(err)
207208
}

0 commit comments

Comments
 (0)