From bdfb96c57d39818c8f8e2bd5103728688c9c8d43 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Tue, 6 Jun 2023 15:23:19 +0800 Subject: [PATCH] chore: os.SEEK_END os.SEEK_SET and use b.Logf(...) instead of b.Log(fmt.Sprintf(...)) --- test/integration/logs/benchmark/benchmark_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/integration/logs/benchmark/benchmark_test.go b/test/integration/logs/benchmark/benchmark_test.go index 38249c648ef..6e0cbe1a438 100644 --- a/test/integration/logs/benchmark/benchmark_test.go +++ b/test/integration/logs/benchmark/benchmark_test.go @@ -18,7 +18,6 @@ package benchmark import ( "errors" - "fmt" "io" "io/fs" "os" @@ -119,7 +118,7 @@ func BenchmarkEncoding(b *testing.B) { test(b, "json", prints) }) - b.Log(fmt.Sprintf("%s: file sizes: %v\n", path, fileSizes)) + b.Logf("%s: file sizes: %v\n", path, fileSizes) }) return nil }); err != nil { @@ -287,11 +286,11 @@ func generateOutput(b *testing.B, config loadGeneratorConfig, files ...*os.File) b.Logf("Wrote %d log entries in %s -> %.1f/s", total, duration, float64(total)/duration.Seconds()) for i, file := range files { if file != nil { - pos, err := file.Seek(0, os.SEEK_END) + pos, err := file.Seek(0, io.SeekEnd) if err != nil { b.Fatal(err) } - if _, err := file.Seek(0, os.SEEK_SET); err != nil { + if _, err := file.Seek(0, io.SeekStart); err != nil { b.Fatal(err) } max := 50