Skip to content

Commit 93ceee9

Browse files
committed
chore: simplify test with t.Setenv
1 parent f7320f1 commit 93ceee9

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ linters:
2525
- nolintlint
2626
- staticcheck
2727
- stylecheck
28+
- tenv
2829
- typecheck
2930
- unconvert
3031
- unparam

run/run_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package run
33
import (
44
"context"
55
"errors"
6-
"os"
76
"sync"
87
"testing"
98

@@ -272,8 +271,7 @@ func TestRunWithInputs(t *testing.T) {
272271
if err != nil {
273272
t.Fatal(err)
274273
}
275-
os.Setenv("FOO", "BAR")
276-
defer os.Unsetenv("FOO")
274+
t.Setenv("FOO", "BAR")
277275
scriptRunner := &mockScriptRunner{}
278276
runner.scriptRunner = scriptRunner
279277
err = runner.Run(context.Background(), "task", nil)

0 commit comments

Comments
 (0)