Skip to content

Commit a8a0783

Browse files
authored
Merge pull request #42 from github/copilot/fix-github-actions-workflow
Update golangci-lint workflow to Go 1.24
2 parents 9173fce + aeb0cba commit a8a0783

File tree

8 files changed

+67
-52
lines changed

8 files changed

+67
-52
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
- uses: actions/checkout@v3
1515
- uses: actions/setup-go@v3
1616
with:
17-
go-version: "1.19"
17+
go-version: "1.24"
1818
- name: Vendor modules for later steps.
1919
run: |
2020
go mod vendor
21-
- uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
21+
- uses: golangci/golangci-lint-action@v9.2.0
2222
with:
23-
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
24-
version: v1.55
23+
# The version of golangci-lint to use (full version with patch number)
24+
version: v2.8.0
2525
args:
2626
-v

.golangci.yml

Lines changed: 56 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,61 @@
22
# The Go Language Working Group is currently working on a finalized version
33
# of this configuration file to share with all Hubbers.
44

5-
linters:
6-
enable:
7-
- depguard
8-
- errcheck
9-
- exportloopref
10-
- gocritic
11-
- gocyclo
12-
- gofmt
13-
- goimports
14-
- gosec
15-
- gosimple
16-
- govet
17-
- ineffassign
18-
- misspell
19-
- nakedret
20-
- prealloc
21-
- revive
22-
- staticcheck
23-
- typecheck
24-
- unconvert
25-
- unused
26-
disable:
27-
- gochecknoglobals # we allow global variables in packages
28-
- gochecknoinits # we allow inits in packages
29-
- goconst # we allow repeated values to go un-const'd
30-
- lll # we allow any line length
31-
- unparam # we allow function calls to name unused parameters
32-
- maligned # clear structs are more important than saving a few bytes.
5+
version: "2"
336

34-
linters-settings:
35-
depguard:
36-
rules:
37-
main:
38-
files:
39-
- "$all"
40-
- "!$test"
41-
deny:
42-
- pkg: io/ioutil
43-
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
7+
linters:
8+
enable:
9+
- copyloopvar
10+
- depguard
11+
- errcheck
12+
- gocritic
13+
- gocyclo
14+
- gosec
15+
- govet
16+
- ineffassign
17+
- misspell
18+
- nakedret
19+
- prealloc
20+
- revive
21+
- staticcheck
22+
- unconvert
23+
- unused
24+
disable:
25+
- gochecknoglobals # we allow global variables in packages
26+
- gochecknoinits # we allow inits in packages
27+
- goconst # we allow repeated values to go un-const'd
28+
- lll # we allow any line length
29+
- unparam # we allow function calls to name unused parameters
30+
settings:
31+
depguard:
32+
rules:
33+
main:
34+
files:
35+
- $all
36+
- '!$test'
37+
deny:
38+
- pkg: io/ioutil
39+
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
40+
exclusions:
41+
generated: lax
42+
presets:
43+
- comments
44+
- common-false-positives
45+
- legacy
46+
- std-error-handling
47+
paths:
48+
- third_party$
49+
- builtin$
50+
- examples$
51+
- internal/deprecated$
4452

45-
run:
46-
timeout: 5m
47-
skip-dirs:
48-
- internal/deprecated
53+
formatters:
54+
enable:
55+
- gofmt
56+
- goimports
57+
exclusions:
58+
generated: lax
59+
paths:
60+
- third_party$
61+
- builtin$
62+
- examples$

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module github.com/github/go-pipe
22

33
go 1.24.0
44

5+
toolchain go1.24.11
6+
57
require (
68
github.com/stretchr/testify v1.11.1
79
go.uber.org/goleak v1.2.1

internal/ptree/ptree_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestWalkChildren(t *testing.T) {
7777
require.Equal(t, "ready", string(ready[:]))
7878

7979
var numChildren int
80-
ptree.WalkChildren(cmd.Process.Pid, func(pid int) {
80+
ptree.WalkChildren(cmd.Process.Pid, func(_ int) {
8181
numChildren++
8282
})
8383
assert.Equal(t, depth, numChildren)

pipe/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (s *commandStage) filterCmdError(err error) error {
201201
// doesn't do anything on Windows, where the `Signaled()`
202202
// method isn't implemented (it is hardcoded to return
203203
// `false`).
204-
ps, ok := eErr.ProcessState.Sys().(syscall.WaitStatus)
204+
ps, ok := eErr.Sys().(syscall.WaitStatus)
205205
if ok && ps.Signaled() &&
206206
(ps.Signal() == syscall.SIGTERM || ps.Signal() == syscall.SIGKILL) {
207207
return ctxErr

pipe/command_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func TestCopyEnvWithOverride(t *testing.T) {
7676
}
7777

7878
for _, ex := range examples {
79-
ex := ex
8079
t.Run(ex.label, func(t *testing.T) {
8180
assert.ElementsMatch(t, ex.expectedResult,
8281
copyEnvWithOverrides(ex.env, ex.overrides))

pipe/pipeline.go

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

3334
//revive:enable:error-naming
@@ -67,7 +68,7 @@ type Pipeline struct {
6768
panicHandler StagePanicHandler
6869
}
6970

70-
var emptyEventHandler = func(e *Event) {}
71+
var emptyEventHandler = func(_ *Event) {}
7172

7273
type nopWriteCloser struct {
7374
io.Writer

pipe/pipeline_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ func TestFunction(t *testing.T) {
473473
pipe.Print("hello world"),
474474
pipe.Function(
475475
"farewell",
476-
func(_ context.Context, _ pipe.Env, stdin io.Reader, stdout io.Writer) error {
476+
func(_ context.Context, _ pipe.Env, _ io.Reader, _ io.Writer) error {
477477
panic("this is a panic")
478478
},
479479
),
@@ -886,7 +886,6 @@ func TestErrors(t *testing.T) {
886886
expectedErr: err1,
887887
},
888888
} {
889-
tc := tc
890889
t.Run(tc.name, func(t *testing.T) {
891890
t.Parallel()
892891

0 commit comments

Comments
 (0)