Repository navigation
build(mocks): Generate mocks with the pinned mockgen and check them in CI - #849
Merged
Merged
Conversation
behinddwalls
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
make mocksresolvedmockgenfromPATH, and nothing in the repo pinned or documented which one to use. On a machine with a differentmockgen(for example the oldergithub.com/golang/mockbinary), it rewrote every checked-in mock with no real changes and failed on generic interfaces such asstovepipe/extension/sourcecontrol. The contributor then had to work out which of the changed files mattered.CI also never ran
make check-mocks, so a PR that changed an interface without regenerating its mock was only caught if a test happened to use the stale mock.What?
make mocksbuilds themockgenpinned ingo.modthrough Bazel (@org_uber_go_mock//mockgen), copies it to the git-ignoredbin/mockgen/, and puts it first onPATHfor thego generaterun. No local install is needed, and the//go:generatedirectives are unchanged.make check-mocks, so stale mocks fail the required checks.doc/howto/DEVELOPMENT.mdnotes both behaviors.Test Plan
On a machine where the
mockgenonPATHis not the pinned one (this was verified on one such machine):make mocksand check that it completes andgit statusis clean.make check-mocks,make lint,make check-gazelle, andmake check-tidyon the committed branch. All pass.The new CI step hasn't run on GitHub yet, so this PR's Tidy job is its first run.
Issue