cmd/go: error out of more commands used by module authors if go.mod's Go version is newer #50468
Labels
FrozenDueToAge
GoCommand
cmd/go
modules
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
#46142 is a great change. It would have saved some head scratching for a coworker of mine, who was running
go mod tidy
on 1.16.x on a module that declaredgo 1.17
. This version mismatch was causing problems, such as unintentionally removing somerequire
lines.I reckon we should throw this error for any command that relates to authoring a module and not just using it. Of course, only when run inside a module that has such a version mismatch. Off the top of my head:
go get
, as nowadays it's only used for changing the module requirements.go work
, given how similar it is togo mod
. Perhaps it should compare with thego 1.N
line in thego.work
file?go fix
andgo generate
, as they can only be useful to an author, given how they modify source filesgo mod
command, not justgo mod tidy
. For instance,go mod edit
orgo mod vendor
both feel potentially broken on a version of Go that's too old.The text was updated successfully, but these errors were encountered: