cmd/go: add a 'go mod tidy' mode that only verifies whether changes are needed #27682
Labels
FeatureRequest
FrozenDueToAge
modules
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Maintainers of large projects will often want to ensure that their module definitions are both complete and minimal at commit time (example: #27643 (comment)).
go mod tidy
is the obvious command to verify that a definition is complete and minimal, but it makes changes even when-mod=readonly
is set (#26850). As far as I am aware, there is no way to verify (nondestructively) that a definition is minimal — only that it is complete (go list all -mod=readonly
), and even then only subject to the currentGOOS
,GOARCH
, and build tags.If we decide not to change the behavior of
go mod tidy -mod=readonly
, I think it's important that we provide some other command that would be suitable for use in a commit hook (along the lines ofgofmt -l
).The text was updated successfully, but these errors were encountered: