Skip to content

build(lint): bump golangci-lint to v2.15.0 and fix its new findings - #14418

Merged
ndeloof merged 2 commits into
docker:mainfrom
ndeloof:lint-bump-golangci
Oct 28, 2026
Merged

ndeloof merged 2 commits into
docker:mainfrom
ndeloof:lint-bump-golangci

Conversation

@ndeloof

@ndeloof ndeloof commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What this PR does, in one sentence

Moves the pinned linter from golangci-lint v2.13.2 to v2.15.0, the latest release, and brings the code back to zero findings under it.

Context

Running a current golangci-lint on main reports four issues that the pinned version does not, so anyone who lints locally with a recent binary sees noise that CI never shows, and the pin only gets further behind. The release updates errcheck (1.20 to 1.30) and gocognit (1.2.1 to 1.3.0), which explains the new reports:

  • runUp now counts 32 against the limit of 30, because of the nested branches that select the services whose logs up follows;
  • errcheck reports three receives from an error channel whose value is dropped on purpose: waiting for the attach copy to end once the context is done (hook.go), draining the container wait channel of a failed hook (pre_start.go), and waiting for Up to return in a test (up_phases_test.go).

What the PR brings

Two commits:

  1. runUp is split. The selection of the attached services (--attach, --attach-dependencies, attach: false in the Compose file, --no-attach) moves, as is, to upOptions.attachedServices. This is a pure extraction. No test covered those rules, so the commit adds a table test for them. It passes under both the old and the new linter.
  2. The bump itself, in the Dockerfile (the only place the version is pinned), with a reason on each of the three intentional discards instead of handling an error nobody can act on. These nolint directives are only needed by the new errcheck: the old linter would call them unused, which is why they go in with the bump rather than before it.

Behavior is unchanged. Linting the branch with v2.15.0 reports no issue, and the same run on main reports the four above.

🤖 Generated with Claude Code

runUp is above the cognitive complexity limit of the linter once gocognit
is updated, because of the nested branches that select the services whose
logs are followed. Move that selection to upOptions.attachedServices, without
changing what it does, and cover its rules (--attach, --no-attach,
--attach-dependencies, attach: false in the Compose file), which no test
exercised.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
The release updates errcheck (1.20 to 1.30) and gocognit (1.2.1 to 1.3.0).
errcheck now reports the receives from an error channel whose value is dropped
on purpose, in three places: waiting for the attach copy to end after the
context is done, draining the container wait channel of a failed hook, and
waiting for Up to return in a test. Say why on each, rather than handling an
error nobody can act on. gocognit's new count is handled by the previous
commit.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof
ndeloof requested review from a team as code owners October 28, 2026 15:12

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/compose/up.go 82.60% 3 Missing and 1 partial ⚠️
pkg/compose/pre_start.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ndeloof
ndeloof enabled auto-merge (rebase) October 28, 2026 15:27
@ndeloof
ndeloof merged commit 343bb38 into docker:main Oct 28, 2026
63 of 65 checks passed
@ndeloof
ndeloof deleted the lint-bump-golangci branch October 28, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants