Skip to content

fix(build): stop go mod tidy running as a side effect of clean - #57

Merged
quike merged 4 commits into
mainfrom
fix/no-tidy-in-build
Sep 16, 2026
Merged

quike merged 4 commits into
mainfrom
fix/no-tidy-in-build

Conversation

@quike

@quike quike commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Closes #56.

make build depended on clean, and clean ran go mod tidy, so building a binary rewrote the module graph. Every build left go.mod/go.sum modified.

Changes

clean no longer tidies. It removes target/ and nothing else, which is what its name and comment claim. A standalone tidy target does the tidying when you actually want it, mirrored in the justfile.

verify gained a non-mutating drift check:

verify:
	go mod verify
	@go mod tidy -diff || (echo "go.mod/go.sum are not tidy; run 'make tidy'" && exit 1)
	go vet -all $(PACKAGES)

go mod tidy -diff reports 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.yml change needed. Since #48 the CI build step runs make build-init verify test, so verify picks the check up for free.

go.mod/go.sum are now actually tidy (second commit). They were not: tidying drops four // indirect entries and 18 go.sum lines. Without this the new check would fail on its first run.

The dropped entries are go-spew, go-difflib, check.v1, and yaml.v3 — testify's own transitive dependencies, declared in its go.mod. Module-graph pruning means keepup does not need to list them, which is why tidy removes them. The full suite passes with -race on the tidied tree.

Verification

Behavioural rather than unit-tested, since no Go code changed:

  • The check fires before it passes. On the untidy tree make verify failed with go.mod/go.sum are not tidy; run 'make tidy' — confirmed before tidying, so the check is not decoration.
  • make verify passes on the tidied tree.
  • make build on a clean tree now leaves git status empty; previously it reported M go.mod and M go.sum.
  • just clean likewise leaves the tree clean, and just --list shows the new tidy recipe with the corrected clean/verify descriptions.
  • go test -race ./... clean; golangci-lint clean apart from the pre-existing nolintlint finding in internal/engine/scheduler_step.go:24.

Note

make verify will now fail for anyone who adds a dependency without running make tidy. That is the point, and the error message names the fix rather than leaving Go's diff output to be interpreted.

@codecov

codecov Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.97%. Comparing base (5ffdb24) to head (22298fc).
⚠️ Report is 1 commits behind head on main.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@quike
quike merged commit 6cdd74f into main Sep 16, 2026
2 checks passed
@quike
quike deleted the fix/no-tidy-in-build branch September 16, 2026 20:35
@quike

quike commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.31.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@quike quike added the released label Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make build mutates go.mod via clean's go mod tidy

1 participant