chore(ci): enforce module tidiness in Build CI - #137
Merged
Merged
Conversation
An untidy go.mod was not checked anywhere, so it surfaced much later as "go: updates to go.mod needed" inside `make generate`, which reads as a codegen bug. #106 and #113 sat red for two weeks looking like exactly that. A `tidy-ci` target already existed for this but ran in neither build-ci nor test-ci, and it invoked `tidied`, a tool this repo never installs, so it would have failed with "command not found" had anything called it. Replaced with `go mod tidy -diff`, which is built into the Go toolchain already in use, needs no new dependency, and prints the offending diff. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Makes an untidy
go.mod/go.sumfail as what it is, instead of surfacing later as a confusing codegen error.Why
Nothing checked module tidiness. So when
examples/go.sumwent stale, it showed up much later insidemake generateas:which reads as a code generator bug. #106 and #113 sat red for two weeks looking like exactly that, when the real problem was one
go mod tidyinexamples/.Two bugs in the existing target
A
tidy-citarget already existed for this, and it had two problems:It was wired into nothing.
build-ciwascheck-fmt lint-ci gosecandtest-ciwastest. Neither called it.It invoked a tool this repo never installs. Both Makefiles called
tidied -verbose, buttidiedappears in nogo install, nomake toolstarget, and no workflow:So had anything ever called it, it would have failed with
tidied: command not found.What this does
tidied -verbosewithgo mod tidy -diffin both Makefiles. That is built into the Go toolchain already in use (added in Go 1.23; repo is on 1.25.7), so it adds no dependency, nothing to install, and nothing further for Renovate to track.tidy-citobuild-ci, so it runs in the Build CI job.tidy-cialready recursed into child modules viagit ls-files '**/*go.mod', so this covers root andexamples/both.Verification
Both modules are currently tidy, so the check passes:
And it genuinely catches untidiness rather than passing vacuously. Perturbing
examples/go.modwith a stale require:Follow-up this does not cover
This makes the failure legible; it does not auto-fix bot PRs. Renovate is handled by #136 (
gomodTidyplus grouping root andexamples/into one branch). Dependabot has no tidy step and cannot be configured fromrenovate.json— auto-fixing its PRs would mean pushing to the PR branch, which needspull_request_targetor an app token, and which makes Renovate mark its own branches "PR Edited (Blocked)" and stop managing them. Left alone deliberately.🤖 Generated with Claude Code