Rationale
errcheck catches ignored error return values that can hide failed I/O, cleanup, persistence, and other operations.
It currently appears in golangci-lint's standard enabled set, but .golangci.yml effectively disables it repository-wide with this exclusion:
- linters:
- errcheck
text: not checked
This is observable today:
go tool golangci-lint run --config ./.golangci.yml --enable-only errcheck --max-issues-per-linter 0 --max-same-issues 0 ./...
0 issues.
Running errcheck without the repository exclusion immediately reports findings, including in cmd/pics/visual, node/app/util, and p2p.
Enabling it in one repository-wide cleanup would be risky and difficult to review. Some ignored errors are intentional, and blindly changing every site to return the error can alter behavior—for example, cleanup errors may need to remain secondary to an earlier operation error, while some operations are deliberately best-effort. Each finding therefore needs package-specific semantic review rather than a mechanical fix.
This supersedes #11180, which was closed as stale; the broad suppression is still present.
Implementation
Bootstrap enforcement in one PR:
- Temporarily remove the broad
text: not checked exclusion and run errcheck with unlimited issue counts to produce a complete baseline grouped by Go package.
- Add temporary path-based exclusions only for packages with baseline findings.
- Keep
errcheck enabled for every package that already passes, so clean and newly added packages cannot introduce unchecked errors.
- Record the excluded-package list and finding counts in a checklist on this issue.
Then migrate one package per PR:
- Review every finding in the package and determine whether the error must be propagated, handled locally, combined with an existing error, or intentionally ignored.
- Add or adjust tests before production changes wherever error handling affects behavior.
- Use narrowly scoped suppressions only where ignoring the error is demonstrably intentional; do not replace the repository-wide exclusion with another broad function or message exclusion.
- Remove that package's temporary exclusion.
- Run
make lint repeatedly until clean, followed by make erigon integration.
- Link the PR from the package checklist item.
Completion criteria
Rationale
errcheckcatches ignored error return values that can hide failed I/O, cleanup, persistence, and other operations.It currently appears in golangci-lint's standard enabled set, but
.golangci.ymleffectively disables it repository-wide with this exclusion:This is observable today:
Running
errcheckwithout the repository exclusion immediately reports findings, including incmd/pics/visual,node/app/util, andp2p.Enabling it in one repository-wide cleanup would be risky and difficult to review. Some ignored errors are intentional, and blindly changing every site to return the error can alter behavior—for example, cleanup errors may need to remain secondary to an earlier operation error, while some operations are deliberately best-effort. Each finding therefore needs package-specific semantic review rather than a mechanical fix.
This supersedes #11180, which was closed as stale; the broad suppression is still present.
Implementation
Bootstrap enforcement in one PR:
text: not checkedexclusion and runerrcheckwith unlimited issue counts to produce a complete baseline grouped by Go package.errcheckenabled for every package that already passes, so clean and newly added packages cannot introduce unchecked errors.Then migrate one package per PR:
make lintrepeatedly until clean, followed bymake erigon integration.Completion criteria
errcheckmessage exclusion is removed.errcheckfor all packages not in the temporary baseline exclusion list.