Skip to content

Commit

Permalink
log/slog: fix window race builder
Browse files Browse the repository at this point in the history
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 <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
cuonglm authored and eric committed Sep 7, 2023
1 parent 2d1bfcb commit 8ef6f92
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/log/slog/json_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"log/slog/internal/buffer"
"math"
"os"
"path/filepath"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -201,7 +202,7 @@ func BenchmarkPreformatting(b *testing.B) {
}),
}

outFile, err := os.Create("/tmp/bench.log")
outFile, err := os.Create(filepath.Join(b.TempDir(), "bench.log"))
if err != nil {
b.Fatal(err)
}
Expand Down

0 comments on commit 8ef6f92

Please sign in to comment.