diff --git a/internal/ptree/ptree_test.go b/internal/ptree/ptree_test.go index 178e16e..9a6d1e2 100644 --- a/internal/ptree/ptree_test.go +++ b/internal/ptree/ptree_test.go @@ -77,7 +77,7 @@ func TestWalkChildren(t *testing.T) { require.Equal(t, "ready", string(ready[:])) var numChildren int - ptree.WalkChildren(cmd.Process.Pid, func(pid int) { + ptree.WalkChildren(cmd.Process.Pid, func(_ int) { numChildren++ }) assert.Equal(t, depth, numChildren) diff --git a/pipe/command.go b/pipe/command.go index 2c465e9..5bbbce5 100644 --- a/pipe/command.go +++ b/pipe/command.go @@ -201,7 +201,7 @@ func (s *commandStage) filterCmdError(err error) error { // doesn't do anything on Windows, where the `Signaled()` // method isn't implemented (it is hardcoded to return // `false`). - ps, ok := eErr.ProcessState.Sys().(syscall.WaitStatus) + ps, ok := eErr.Sys().(syscall.WaitStatus) if ok && ps.Signaled() && (ps.Signal() == syscall.SIGTERM || ps.Signal() == syscall.SIGKILL) { return ctxErr diff --git a/pipe/command_test.go b/pipe/command_test.go index 92fd37a..ca5a8c0 100644 --- a/pipe/command_test.go +++ b/pipe/command_test.go @@ -76,7 +76,6 @@ func TestCopyEnvWithOverride(t *testing.T) { } for _, ex := range examples { - ex := ex t.Run(ex.label, func(t *testing.T) { assert.ElementsMatch(t, ex.expectedResult, copyEnvWithOverrides(ex.env, ex.overrides)) diff --git a/pipe/pipeline.go b/pipe/pipeline.go index 9df1b51..8bc3a37 100644 --- a/pipe/pipeline.go +++ b/pipe/pipeline.go @@ -28,6 +28,7 @@ type Env struct { // and is not reported to the caller. // //revive:disable:error-naming +//nolint:staticcheck // ST1012: FinishEarly is the intentional name for this sentinel error var FinishEarly = errors.New("finish stage early") //revive:enable:error-naming @@ -67,7 +68,7 @@ type Pipeline struct { panicHandler StagePanicHandler } -var emptyEventHandler = func(e *Event) {} +var emptyEventHandler = func(_ *Event) {} type nopWriteCloser struct { io.Writer diff --git a/pipe/pipeline_test.go b/pipe/pipeline_test.go index ddb16c4..bebc931 100644 --- a/pipe/pipeline_test.go +++ b/pipe/pipeline_test.go @@ -473,7 +473,7 @@ func TestFunction(t *testing.T) { pipe.Print("hello world"), pipe.Function( "farewell", - func(_ context.Context, _ pipe.Env, stdin io.Reader, stdout io.Writer) error { + func(_ context.Context, _ pipe.Env, _ io.Reader, _ io.Writer) error { panic("this is a panic") }, ), @@ -886,7 +886,6 @@ func TestErrors(t *testing.T) { expectedErr: err1, }, } { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel()