Skip to content

Commit

Permalink
Fixed new linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Sep 17, 2024
1 parent 365c534 commit 296cafb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
11 changes: 7 additions & 4 deletions log_entries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package logger

import (
"bytes"
"errors"
"os"
"os/exec"
"testing"
Expand Down Expand Up @@ -156,10 +157,11 @@ func TestLogClient_Fatalf(t *testing.T) {
client.Fatalf("test %d", 1)
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestLogClient_Fatalf")
cmd := exec.Command(os.Args[0], "-test.run=TestLogClient_Fatalf") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand All @@ -176,10 +178,11 @@ func TestLogClient_Fatalln(t *testing.T) {
client.Fatalln("test exit")
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestLogClient_Fatalln")
cmd := exec.Command(os.Args[0], "-test.run=TestLogClient_Fatalln") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand Down
31 changes: 19 additions & 12 deletions logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package logger

import (
"bytes"
"errors"
"fmt"
"io"
"log"
Expand Down Expand Up @@ -347,10 +348,11 @@ func TestFatalf(t *testing.T) {
Fatalf("test %d", 1)
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestFatalf")
cmd := exec.Command(os.Args[0], "-test.run=TestFatalf") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand All @@ -369,10 +371,11 @@ func TestFatal(t *testing.T) {
Fatal("test exit")
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestFatal")
cmd := exec.Command(os.Args[0], "-test.run=TestFatal") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand All @@ -391,10 +394,11 @@ func TestFatalln(t *testing.T) {
Fatalln("test exit")
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestFatalln")
cmd := exec.Command(os.Args[0], "-test.run=TestFatalln") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand All @@ -413,10 +417,11 @@ func TestPanic(t *testing.T) {
Panic("test exit")
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestPanic")
cmd := exec.Command(os.Args[0], "-test.run=TestPanic") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand All @@ -435,10 +440,11 @@ func TestPanicln(t *testing.T) {
Panicln("test exit")
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestPanicln")
cmd := exec.Command(os.Args[0], "-test.run=TestPanicln") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand All @@ -460,10 +466,11 @@ func TestPanicf(t *testing.T) {
Panicf("test %d", 1)
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestPanicf")
cmd := exec.Command(os.Args[0], "-test.run=TestPanicf") //nolint:gosec // G204
cmd.Env = append(os.Environ(), "EXIT_FUNCTION=1")
err = cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
var e *exec.ExitError
if errors.As(err, &e) && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
Expand Down

0 comments on commit 296cafb

Please sign in to comment.