Skip to content
Merged
8 changes: 4 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.19"
go-version: "1.24"
- name: Vendor modules for later steps.
run: |
go mod vendor
- uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
- uses: golangci/golangci-lint-action@v9.2.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.55
# The version of golangci-lint to use (full version with patch number)
version: v2.8.0
args:
-v
98 changes: 56 additions & 42 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,61 @@
# The Go Language Working Group is currently working on a finalized version
# of this configuration file to share with all Hubbers.

linters:
enable:
- depguard
- errcheck
- exportloopref
- gocritic
- gocyclo
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- typecheck
- unconvert
- unused
disable:
- gochecknoglobals # we allow global variables in packages
- gochecknoinits # we allow inits in packages
- goconst # we allow repeated values to go un-const'd
- lll # we allow any line length
- unparam # we allow function calls to name unused parameters
- maligned # clear structs are more important than saving a few bytes.
version: "2"

linters-settings:
depguard:
rules:
main:
files:
- "$all"
- "!$test"
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
linters:
enable:
- copyloopvar
- depguard
- errcheck
- gocritic
- gocyclo
- gosec
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unused
disable:
- gochecknoglobals # we allow global variables in packages
- gochecknoinits # we allow inits in packages
- goconst # we allow repeated values to go un-const'd
- lll # we allow any line length
- unparam # we allow function calls to name unused parameters
settings:
depguard:
rules:
main:
files:
- $all
- '!$test'
deny:
- pkg: io/ioutil
desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
- internal/deprecated$

run:
timeout: 5m
skip-dirs:
- internal/deprecated
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
Comment on lines +5 to +62
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The golangci-lint configuration format appears to be incorrect. The "version: 2" format is not a valid golangci-lint configuration version. The "formatters" section and the top-level "exclusions" section are not standard configuration keys in golangci-lint. Formatters like gofmt and goimports should be configured as linters in the "linters" section, and exclusions should be under "issues.exclude-rules" or similar. Please consult the golangci-lint documentation for the correct v1.x configuration format.

Copilot uses AI. Check for mistakes.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/github/go-pipe

go 1.24.0

toolchain go1.24.11

require (
github.com/stretchr/testify v1.11.1
go.uber.org/goleak v1.2.1
Expand Down
2 changes: 1 addition & 1 deletion internal/ptree/ptree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pipe/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pipe/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 2 additions & 1 deletion pipe/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,7 +68,7 @@ type Pipeline struct {
panicHandler StagePanicHandler
}

var emptyEventHandler = func(e *Event) {}
var emptyEventHandler = func(_ *Event) {}

type nopWriteCloser struct {
io.Writer
Expand Down
3 changes: 1 addition & 2 deletions pipe/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
},
),
Expand Down Expand Up @@ -886,7 +886,6 @@ func TestErrors(t *testing.T) {
expectedErr: err1,
},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
Loading