From 816cb0239e52811d2312303370a8caa1db76b1d7 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Thu, 13 May 2021 13:00:26 +0900 Subject: [PATCH] fix: golangci-lint run ./... --- cmd/benchmark_test.go | 16 +++++++++++++--- cmd/version_test.go | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cmd/benchmark_test.go b/cmd/benchmark_test.go index 40980c6..587255f 100644 --- a/cmd/benchmark_test.go +++ b/cmd/benchmark_test.go @@ -3,6 +3,7 @@ package cmd import ( "bytes" "io" + "log" "testing" "time" ) @@ -24,7 +25,10 @@ func BenchmarkCopy(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - CopyTime(buf, lr, time.Now().Add(-50*time.Millisecond)) + _, err := CopyTime(buf, lr, time.Now().Add(-50*time.Millisecond)) + if err != nil { + log.Fatal(err) + } buf.Reset() rd.Reset(bs) } @@ -60,7 +64,10 @@ func BenchmarkWriter(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - io.Copy(w, lr) + _, err := io.Copy(w, lr) + if err != nil { + log.Fatal(err) + } buf.Reset() rd.Reset(bs) } @@ -83,7 +90,10 @@ func BenchmarkWriterBig(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - io.Copy(w, rd) + _, err := io.Copy(w, rd) + if err != nil { + log.Fatal(err) + } buf.Reset() rd.Reset(bs) } diff --git a/cmd/version_test.go b/cmd/version_test.go index 5e8af84..cc5eab0 100644 --- a/cmd/version_test.go +++ b/cmd/version_test.go @@ -3,6 +3,7 @@ package cmd import ( "bytes" "fmt" + "log" "runtime" "strings" "testing" @@ -33,7 +34,9 @@ func TestBuildEnvsString(t *testing.T) { cmdArgs := strings.Split(command, " ") fmt.Printf("cmdArgs %+v\n", cmdArgs) cmd.SetArgs(cmdArgs[1:]) - cmd.Execute() + if err := cmd.Execute(); err != nil { + log.Fatal(err) + } out := buf.String() assert.Equal(t, want, out, "they should be equal")