Go staticcheck / golangci-lint failures - Fix in CI
staticcheck and golangci-lint gate CI on lint findings. A failure is either a genuine issue in the code or drift between the linter version/config used locally and in CI.
What this error means
A lint step fails listing findings like SA4006: value never used or errcheck: error return not checked, or it errors loading config. Local runs may pass when a different linter version or .golangci.yml is in effect.
pkg/handler.go:42:2: SA4006: this value of err is never used (staticcheck)
pkg/store.go:18:9: Error return value is not checked (errcheck)Common causes
Genuine lint findings
The linter caught real issues - unused values, unchecked errors, or shadowed variables.
Linter version or config drift
CI runs a different linter version or .golangci.yml than local, so the rule set differs.
How to fix it
Fix the findings
- Address each reported issue, then re-run the linter to confirm a clean pass.
golangci-lint run ./...Pin the linter version in CI
- Pin a fixed golangci-lint version so local and CI use the same rule set.
- uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1How to prevent it
- Pin the linter version in CI and document it for local use.
- Commit a single
.golangci.ymlas the source of truth. - Run the linter locally before pushing.