Repository navigation
Description
golangci-lint does not run anywhere in spawn's CI, and the root module has a large backlog of findings. Nothing stops the backlog from growing, and anyone who runs it locally gets failures that have nothing to do with their change.
Measured
golangci-lint v2.14.0, built-in default config (spawn has no .golangci.yml), root module (./...), on main at 24892d6:
- With the default output caps (50 per linter, 3 identical):
107 issues: errcheck 39, staticcheck 36, unused 32 - Uncapped (
--max-issues-per-linter=0 --max-same-issues=0): 439 issues: errcheck 358, staticcheck 49, unused 32- errcheck: 320 of the 358 are unchecked
fmt.Fprint*(256Fprintf, 58Fprintln, 6Fprint), mostly incmd/(333 of all 439 findings are undercmd/). The others areresp.Body.Close,f.Close,os.Setenvin tests, and so on. - staticcheck: SA1019 21, QF1001 12, ST1005 6, SA1012 4, S1 3, QF1011 3, SA4023 1, SA4000 1, QF1003 1
- unused: 32, including several
test/e2e/helpers.gohelpers - 49 of the 439 are in
_test.gofiles.
- errcheck: 320 of the 358 are unchecked
The nine nested modules (scripts/nested-modules.sh) were not measured.
(The count I was given before measuring was "~42", which is far below either figure. It may have come from a different linter set, version or tree. The numbers above are the ones to start from.)
Relationship to existing work
- make check's staticcheck step can never fail: '|| echo not installed' swallows real findings (67 on main) #923 / PR Make staticcheck blocking in make check and CI, and fix its 67 findings (#923) #938 cover staticcheck only: they make
make check's staticcheck step able to fail, and fix its findings. golangci-lint's default set also runs errcheck and unused (and its staticcheck includes the QF/S checks), so most of the 439 are outside that PR's scope. make check's staticcheck step can never fail: '|| echo not installed' swallows real findings (67 on main) #923 notes in passing that "CI doesn't run staticcheck or golangci-lint at all"; this issue tracks the golangci-lint half.
Suggested
Do what truffle did in spore-host/truffle#196 (for truffle#192):
- Add a
lintjob to.github/workflows/ci.ymlthat runsmake lint(the same target contributors run). Install golangci-lint at a pinned version and pinned SHA-256 (in the workflow, not read from the release's checksums file), the same way spawn's gitleaks install is pinned. - Pin
GOLANGCI_LINT_VERSIONin the Makefile next to thelinttarget, and warn locally when the installed version differs. - Before the job can be blocking, either fix the findings or commit a
.golangci.ymlthat narrows the rules deliberately. For example, excludeerrcheckonfmt.Fprint*to a terminal writer, which accounts for about 73% of the total. Narrowing a check should be a reviewed decision, not something a default does. - Decide whether the nested modules are linted as well;
make check-nestedalready enumerates them.
Not attempted in the PRs for #1013/#1014. Filed so the backlog has an owner.
Activity
scttfrdmn commentedon Oct 19, 2026
Decision needed (milestone planning, 2026-10-18): fix all 439 golangci-lint findings, or commit a narrowing
.golangci.ymland ratchet?Default if there's no objection: commit a narrowing config that passes today, run it in CI, and widen it one linter at a time.
ci: run golangci-lint with a ratcheting config (#1028) (#1216)