Skip to content

Fix the CI lint gate and resolve golangci-lint findings#20

Merged
OmarAlJarrah merged 2 commits into
mainfrom
fix/ci-lint-gate
Jun 16, 2026
Merged

Fix the CI lint gate and resolve golangci-lint findings#20
OmarAlJarrah merged 2 commits into
mainfrom
fix/ci-lint-gate

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

The lint CI job has been failing on every run, including main — the project's golangci-lint quality gate was never actually enforced. This fixes the job so it runs, and resolves every finding it surfaces.

Why the job failed

golangci-lint-action@v6 installs a golangci-lint v1 binary built with Go 1.24, but the module targets go 1.26 and the config is v2-format. golangci-lint refuses to run when its own build Go version is older than the target module's, so it exited before linting anything.

The fix builds golangci-lint v2 from source with the CI's Go 1.26 toolchain (go install …@v2.12.2), so the binary's Go version matches the module and the v2 config loads.

Findings resolved (first real run of the linter)

  • Real fix: the RFC 8288 Link-header pager (pagination.NewLinkHeader) read each response's Link header but never closed the body — a connection leak. The pager owns the response once fetch returns it, so it now closes the body after extracting the link. (bodyclose)
  • Justified annotations (targeted //nolint with rationale): MD5 is mandated by RFC 7616 Digest (gosec G501); the transport issuing the caller's own request is not SSRF (gosec G704); the Digest policy intentionally returns the 401 when a body can't be rewound (nilerr).
  • Test tidy-ups: http.StatusOK instead of the 200 literal, a De Morgan rewrite, an explicit alias on the umbrella import, and a checked fmt.Fprint.
  • bodyclose is scoped to non-test code — test stub transporters return in-memory bodies (NopCloser/http.NoBody) that hold no resources.

Test plan

  • golangci-lint run ./... (v2.12.2, built with go1.26.3): 0 issues
  • gofmt -l . clean, go vet ./... clean, go test -race ./... green across all packages
  • CI lint job verified green on this branch

🤖 Generated with Claude Code

Close the response body in the Link-header pager after reading the Link
header (the pager owns the response once fetch returns it). Annotate the
protocol-mandated MD5 import and the SSRF-taint false positive on the
transport, and the intentional non-error return when a Digest 401 cannot be
retried. Tidy test stubs (http.StatusOK, De Morgan rewrite) and scope the
bodyclose check to non-test code, where stub bodies hold no resources.
@OmarAlJarrah OmarAlJarrah merged commit 14dd048 into main Jun 16, 2026
2 checks passed
@OmarAlJarrah OmarAlJarrah deleted the fix/ci-lint-gate branch June 16, 2026 21:21
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.

1 participant