fix(build): stop go mod tidy running as a side effect of clean - #57
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #57 +/- ##
=======================================
Coverage 92.97% 92.97%
=======================================
Files 27 27
Lines 1565 1565
=======================================
Hits 1455 1455
Misses 107 107
Partials 3 3 🚀 New features to boost your workflow:
|
Owner
Author
|
🎉 This PR is included in version 1.31.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Closes #56.
make builddepended onclean, andcleanrango mod tidy, so building a binary rewrote the module graph. Every build leftgo.mod/go.summodified.Changes
cleanno longer tidies. It removestarget/and nothing else, which is what its name and comment claim. A standalonetidytarget does the tidying when you actually want it, mirrored in the justfile.verifygained a non-mutating drift check:go mod tidy -diffreports what would change and exits non-zero without writing anything — so the tree stays honest without any target mutating it. Verified in both directions: exit 1 on an untidy tree, exit 0 on a tidy one.No
ci.ymlchange needed. Since #48 the CI build step runsmake build-init verify test, soverifypicks the check up for free.go.mod/go.sumare now actually tidy (second commit). They were not: tidying drops four// indirectentries and 18go.sumlines. Without this the new check would fail on its first run.The dropped entries are
go-spew,go-difflib,check.v1, andyaml.v3— testify's own transitive dependencies, declared in itsgo.mod. Module-graph pruning means keepup does not need to list them, which is whytidyremoves them. The full suite passes with-raceon the tidied tree.Verification
Behavioural rather than unit-tested, since no Go code changed:
make verifyfailed withgo.mod/go.sum are not tidy; run 'make tidy'— confirmed before tidying, so the check is not decoration.make verifypasses on the tidied tree.make buildon a clean tree now leavesgit statusempty; previously it reportedM go.modandM go.sum.just cleanlikewise leaves the tree clean, andjust --listshows the newtidyrecipe with the correctedclean/verifydescriptions.go test -race ./...clean;golangci-lintclean apart from the pre-existingnolintlintfinding ininternal/engine/scheduler_step.go:24.Note
make verifywill now fail for anyone who adds a dependency without runningmake tidy. That is the point, and the error message names the fix rather than leaving Go's diff output to be interpreted.