Skip to content

Commit 79f4a1a

Browse files
znullCopilot
andcommitted
Fix lint errors
- Remove Go 1.22+ unnecessary loop variable copy (copyloopvar) - Replace unused parameters with _ (revive) - Add nolint directive for FinishEarly naming (staticcheck ST1012) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fa6c12d commit 79f4a1a

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

pipe/memorylimit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func testMemoryLimit(t *testing.T, mbs int, limit uint64, stage pipe.Stage) (str
150150
p.Add(
151151
pipe.Function(
152152
"write-to-less",
153-
func(ctx context.Context, _ pipe.Env, _ io.Reader, stdout io.Writer) error {
153+
func(_ context.Context, _ pipe.Env, _ io.Reader, stdout io.Writer) error {
154154
// Write some nonsense data to less.
155155
var bytes [1_000_000]byte
156156
for i := 0; i < mbs; i++ {
@@ -185,7 +185,7 @@ func testMemoryLimitWithObserver(t *testing.T, mbs int, limit uint64, stage pipe
185185
p.Add(
186186
pipe.Function(
187187
"write-to-less",
188-
func(ctx context.Context, _ pipe.Env, _ io.Reader, stdout io.Writer) error {
188+
func(_ context.Context, _ pipe.Env, _ io.Reader, stdout io.Writer) error {
189189
var bytes [1_000_000]byte
190190
for i := 0; i < mbs; i++ {
191191
_, err := stdout.Write(bytes[:])

pipe/pipe_matching_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,6 @@ func TestPipeTypes(t *testing.T) {
360360
},
361361
},
362362
} {
363-
tc := tc
364-
365363
t.Run(tc.name, func(t *testing.T) {
366364
t.Parallel()
367365

pipe/pipeline.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type Env struct {
2929
// and is not reported to the caller.
3030
//
3131
//revive:disable:error-naming
32+
//nolint:staticcheck // ST1012: FinishEarly is the intentional name for this sentinel error
3233
var FinishEarly = errors.New("finish stage early")
3334

3435
//revive:enable:error-naming
@@ -68,7 +69,7 @@ type Pipeline struct {
6869
panicHandler StagePanicHandler
6970
}
7071

71-
var emptyEventHandler = func(e *Event) {}
72+
var emptyEventHandler = func(_ *Event) {}
7273

7374
type NewPipeFn func(opts ...Option) *Pipeline
7475

pipe/pipeline_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ func BenchmarkMoreDataUnbuffered(b *testing.B) {
10071007
p.Add(
10081008
pipe.Function(
10091009
"seq",
1010-
func(ctx context.Context, _ pipe.Env, stdin io.Reader, stdout io.Writer) error {
1010+
func(_ context.Context, _ pipe.Env, _ io.Reader, stdout io.Writer) error {
10111011
for i := 1; i <= 100000; i++ {
10121012
fmt.Fprintln(stdout, i)
10131013
}
@@ -1025,7 +1025,7 @@ func BenchmarkMoreDataUnbuffered(b *testing.B) {
10251025
pipe.Command("cat"),
10261026
pipe.LinewiseFunction(
10271027
"count",
1028-
func(ctx context.Context, _ pipe.Env, line []byte, stdout *bufio.Writer) error {
1028+
func(_ context.Context, _ pipe.Env, _ []byte, _ *bufio.Writer) error {
10291029
count++
10301030
return nil
10311031
},
@@ -1052,7 +1052,7 @@ func BenchmarkMoreDataBuffered(b *testing.B) {
10521052
p.Add(
10531053
pipe.Function(
10541054
"seq",
1055-
func(ctx context.Context, _ pipe.Env, stdin io.Reader, stdout io.Writer) error {
1055+
func(_ context.Context, _ pipe.Env, _ io.Reader, stdout io.Writer) error {
10561056
out := bufio.NewWriter(stdout)
10571057
for i := 1; i <= 1000000; i++ {
10581058
fmt.Fprintln(out, i)
@@ -1071,7 +1071,7 @@ func BenchmarkMoreDataBuffered(b *testing.B) {
10711071
pipe.Command("cat"),
10721072
pipe.LinewiseFunction(
10731073
"count",
1074-
func(ctx context.Context, _ pipe.Env, line []byte, stdout *bufio.Writer) error {
1074+
func(_ context.Context, _ pipe.Env, _ []byte, stdout *bufio.Writer) error {
10751075
count++
10761076
return nil
10771077
},

0 commit comments

Comments
 (0)