Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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$
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module github.com/github/go-pipe

go 1.19
go 1.24.0

toolchain go1.24.11

require (
github.com/stretchr/testify v1.11.1
go.uber.org/goleak v1.2.1
golang.org/x/sync v0.7.0
golang.org/x/sync v0.19.0
)

require (
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -10,9 +11,10 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
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