Repository navigation
gha: Update golangci-lint to v2.13.2 - #14089
Conversation
Signed-off-by: Paweł Gronowski <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The changes are consistent, mechanical, and scoped to tooling/lint upgrades plus straightforward modernizations without introducing behavioral risk in core logic.
Pull request overview
This PR updates the repository’s linting/tooling to a newer golangci-lint version (v2.13.2) to keep CI/dev tooling compatible with newer Go toolchains, and includes a set of small Go modernizations and lint-driven cleanups across the codebase.
Changes:
- Bump golangci-lint to v2.13.2 in both CI and dev-tool installation.
- Modernize several reverse-iteration loops to use
slices.Backwardand simplify error type assertions usingerrors.AsType. - Reduce linter noise and improve safety/correctness in a few spots (e.g., use
DialContext, safer editor invocation, gosec suppressions with rationale, improved goroutine contexts).
File summaries
| File | Description |
|---|---|
| script/setup/install-dev-tools | Updates locally-installed golangci-lint to v2.13.2. |
| .github/workflows/ci.yml | Updates CI golangci-lint version to v2.13.2. |
| .golangci.yml | Adjusts gosec excludes (adds G703, G122) for new lint behavior. |
| plugins/cri/cri.go | Uses slices.Backward for clearer reverse scan of env PATH. |
| core/remotes/handlers.go | Uses slices.Backward for reverse dispatch ordering. |
| core/remotes/docker/fetcher.go | Uses slices.Backward for reverse encoding handling; minor cleanup. |
| core/remotes/docker/authorizer.go | Simplifies error matching via errors.AsType. |
| core/mount/mount.go | Uses slices.Backward for reverse unmount ordering. |
| core/mount/manager/manager.go | Uses slices.Backward during deactivation unmount sequence. |
| core/diff/stream.go | Uses slices.Backward to prioritize later-registered handlers. |
| pkg/shim/util_unix.go | Replaces errors.As boilerplate with errors.AsType. |
| internal/cri/util/sanitize.go | Uses errors.AsType for *url.Error extraction. |
| internal/cri/server/sandbox_run.go | Uses errors.AsType for cleanup error detection. |
| internal/cri/server/container_create.go | Uses errors.AsType for reserved-name concurrency warning path. |
| internal/cri/server/podsandbox/sandbox_run.go | Improves exit-wait goroutine context propagation using WithoutCancel + namespace. |
| internal/cri/server/podsandbox/recover.go | Same exit-wait context improvement during recovery. |
| cmd/containerd/server/server.go | Uses slices.Backward for reverse plugin stop ordering. |
| cmd/containerd/server/config/config.go | Uses errors.AsType for TOML decode error handling. |
| cmd/containerd-shim-runc-v2/task/service.go | Uses context.WithoutCancel(ctx) for publisher forwarding context. |
| cmd/ctr/commands/shim/pprof.go | Uses DialContext and net.Dialer.DialContext for better cancellation behavior. |
| cmd/ctr/commands/pprof/pprof.go | Switches transport to DialContext for pprof client. |
| cmd/ctr/commands/pprof/pprof_unix.go | Updates dialer signature to DialContext-compatible and uses net.Dialer. |
| cmd/ctr/commands/pprof/pprof_windows.go | Updates dialer signature to DialContext-compatible and uses DialPipeContext. |
| cmd/ctr/commands/content/content.go | Safer editor invocation by passing filename via "$@" rather than string interpolation. |
| contrib/apparmor/template.go | Adds justified gosec suppression for fixed-executable command invocation. |
| integration/failpoint/cmd/runc-fp/main.go | Adds justified gosec suppression for fixed-executable proxy invocation. |
Review details
- Files reviewed: 26/26 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
For Go1.27 support Staticcheck analyzes only the files selected for the current OS. On macOS, unsupported-platform stubs always return errors, so SA4023 mistakes valid shared error checks for constant comparisons. The Linux and Windows implementations can still return nil. Exclude SA4023 only at the affected cross-platform call sites, keeping the check active elsewhere. Also use a single-line pipe wrapper return because Go 1.26 and Go 1.27 gofmt disagree on the multiline indentation. Signed-off-by: Paweł Gronowski <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
a1bd4f6 to
3c10e5f
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The updates are consistent with the stated Go 1.27 support goal and the changes are mechanical/low-risk with no correctness issues found in the modified code paths.
Review details
- Files reviewed: 26/26 changed files
- Comments generated: 0 new
- Review effort level: Lite
For Go1.27 support