Skip to content

Update mockery to v3 and golangci-lint to v2 - #232

Closed
Chengxuan wants to merge 1 commit into
mainfrom
lint-mock-upgrade
Closed

Chengxuan wants to merge 1 commit into
mainfrom
lint-mock-upgrade

Conversation

@Chengxuan

@Chengxuan Chengxuan commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Both tools needed major version bumps.

  • golangci-lint was pinned at v1.64.8, the last v1 release (the project has fully moved to v2, which uses a new config schema).
  • mockery was installed from github.com/vektra/mockery/cmd/mockery@latest, an unversioned v1 import path that's frozen years behind current releases. Neither had a version left to bump within their existing major, so this does both migrations together.

They're bundled in one PR because the mockery jump is what makes the golangci-lint jump safe to verify: golangci-lint v2's staticcheck (merged with gosimple/stylecheck) flags a few things in the mock output as generated code changes shape, and running the full make lint && make test cycle once, on the final state of both tools, is the only way to be confident neither upgrade silently broke the other's assumptions. Splitting them would mean landing a golangci-lint config rewrite that's only really been exercised against soon-to-be-replaced mocks, or landing a mock rewrite that hasn't been linted with the tool version it'll actually ship next to.

Changes

  • .golangci.yml: migrated to the v2 config schema (via golangci-lint migrate), same linter set preserved (v2 merges gosimple/stylecheck into staticcheck; errcheck/govet/ineffassign/unused are default-enabled in v2 and no longer need listing).
  • .mockery.yml (new): v3 is config-driven, no CLI flags. Configured the same 4 interfaces (Backend, Subscription, Manager, BlockListener) at their existing output paths and package names, with unroll-variadic: true to preserve v2's variadic-arg-flattening behavior (v3 defaults to passing them as a single slice, which broke two existing test suites' .On(...) expectations).
  • Makefile: mocks target now just runs mockery (config does the rest); lint/mockery install targets bumped to v2.13.2 / v3.8.0.
  • 4 mock files regenerated — same struct/constructor names, additive EXPECT() API, no test changes needed.
  • Fixed the new issues golangci-lint v2 caught:
    • 6 staticcheck (QF1008): redundant embedded-field selectors (bl.BlockListenerConfig.X → bl.X) in exec_query.go, prepare_transaction.go, blocklistener.go, confirmation_reconciler.go, ethrpc.go.
    • 9 goconst: repeated JSON map-key string literals in pkg/ethrpc replaced with shared constants (keyAddress, keyBlockHash, keyBlockNumber, keyHash, keyLogsBloom, keyNumber, keyTransactionIndex).

Test plan

  • make lint — 0 issues
  • make test — all packages pass
  • Verified mock regeneration is deterministic (mockery run twice produces identical output)
  • Verified make mocks works from a clean toolchain (binaries removed and reinstalled)

🤖 Generated with Claude Code and then edited to make the wordings clear

Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
@Chengxuan
Chengxuan requested a review from a team as a code owner September 10, 2026 08:19
@Chengxuan
Chengxuan marked this pull request as draft September 10, 2026 14:51
@Chengxuan

Copy link
Copy Markdown
Contributor Author

Hold on for this upgrade as it will change developer toolings and affect the wider firefly ecosystem

@Chengxuan Chengxuan closed this Sep 10, 2026
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