Skip to content

cmd: enable errcheck across cmd/* CLI tooling and fix violations - #23630

Merged
AskAlexSharov merged 4 commits into
erigontech:mainfrom
Sahil-4555:sahil4555/enable-errcheck-cmd
Aug 29, 2026
Merged

cmd: enable errcheck across cmd/* CLI tooling and fix violations#23630
AskAlexSharov merged 4 commits into
erigontech:mainfrom
Sahil-4555:sahil4555/enable-errcheck-cmd

Conversation

@Sahil-4555

Copy link
Copy Markdown
Collaborator

Continues the errcheck rollout for #22538 into ten cmd/* packages: cmd/capcli, cmd/caplin/caplin1, cmd/evm(+internal/t8ntool), cmd/integration/commands, cmd/rlpdump, cmd/rpcdaemon/cli, cmd/rpcdaemon/health, cmd/utils/app, cmd/utils/cmdtest.

Notable fixes beyond lint-satisfying:

  • missingBlocks (import tooling) called headBlock.NumberU64() right after a discarded chainDB.View call - a failed view left headBlock nil, a live panic. Traced the surrounding branch to its original 2021 commit and confirmed it never actually differentiated behavior; removed the dead branch along with the now-unused blockReader parameter.
  • A slot-range verification loop in capcli logged "Successfully checked" unconditionally even when ReadBlockBySlot failed mid-loop, defeating the point of a checking tool.
  • t8ntool's DumpToCollector (the tool's actual output) and MakePreState's genesis-account setters were silently discarded; the latter now panics consistently with the rest of that function instead of a mix of checked/unchecked calls.
  • caplin1.OpenCaplinDatabase's startup RemoveAll/MkdirAll/genesisDb.Initialize calls were unchecked, risking either a skipped wipeout or a MustOpen panic on a missing directory instead of a clear error.

Deduplicated the defer l.Unlock() datadir-flock pattern (copied ~15 times across snapshots_cmd.go/squeeze_cmd.go/backtest_commitment_cmd.go) into a single unlockDatadir helper, matching the convention already established in backtest_commitment_cmd.go rather than inventing a new one.

Copilot AI 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.

Pull request overview

Enables errcheck across ten CLI packages and handles previously ignored errors.

Changes:

  • Propagates database, state, output, and filesystem errors.
  • Fixes import and snapshot-verification failure handling.
  • Centralizes datadir unlock handling.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.golangci.yml Enables errcheck for migrated packages.
cmd/capcli/cli.go Propagates snapshot and state errors.
cmd/caplin/caplin1/run.go Checks database setup and initialization errors.
cmd/evm/internal/t8ntool/execution.go Checks genesis state mutations.
cmd/evm/internal/t8ntool/transition.go Handles dump and cleanup errors.
cmd/evm/runner.go Handles state mutation and cleanup errors.
cmd/evm/staterunner.go Reports temporary-directory cleanup failures.
cmd/integration/commands/commitment.go Checks output synchronization.
cmd/integration/commands/stages.go Explicitly handles intentional ignored errors.
cmd/integration/commands/state_history.go Propagates history scan and unlock errors.
cmd/rlpdump/main.go Propagates RLP list-finalization errors.
cmd/rpcdaemon/cli/config.go Handles database-view and gRPC serving errors.
cmd/rpcdaemon/health/health.go Reports response-write failures.
cmd/utils/app/backtest_commitment_cmd.go Uses shared datadir unlock handling.
cmd/utils/app/import_cmd.go Propagates database errors and simplifies missing-block detection.
cmd/utils/app/snapshots_cmd.go Handles unlock and deletion errors.
cmd/utils/app/squeeze_cmd.go Uses shared datadir unlock handling.
cmd/utils/cmdtest/test_cmd.go Propagates stdin write errors and marks intentional ignores.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/caplin/caplin1/run.go
Comment thread cmd/utils/app/import_cmd.go
Comment thread cmd/rpcdaemon/cli/config.go

Copilot AI 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.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Comment thread cmd/rlpdump/main.go
@AskAlexSharov
AskAlexSharov added this pull request to the merge queue Aug 29, 2026
Merged via the queue into erigontech:main with commit 5be3d9e Aug 29, 2026
137 checks passed
@Sahil-4555
Sahil-4555 deleted the sahil4555/enable-errcheck-cmd branch August 29, 2026 07:46
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