When the go and toolchain directives are equal, go mod tidy removes the toolchain directive, which in my opinion, "removes the intent" of managing the toolchain version with the go.mod file.
When that happens, tools like dependency update automation (e.g. Dependabot, Renovate) will stop updating the Go version of the project (since the go directive is the minimal supported version, it is not usually desirable to update with the same frequency). And these tools will not add it back since they cannot tell whatever the user wishes to use toolchain, the "intent" has been removed.
The go directive often gets bump by go mod tidy when a dependency requires it, which happens fairly often.
The current behavior adds extra work for the user to keep an eye on the presence of the toolchain directive in their go.mod file, to add it back when there is a new release. Possibly allowing CVEs to accumulate if they do not notice or forget.
Basically, when a user has opted into using toolchain, they should never be opted out by go mod tidy.
Would that sound like reasonable change for go mod tidy?
When the
goandtoolchaindirectives are equal,go mod tidyremoves thetoolchaindirective, which in my opinion, "removes the intent" of managing the toolchain version with thego.modfile.When that happens, tools like dependency update automation (e.g. Dependabot, Renovate) will stop updating the Go version of the project (since the
godirective is the minimal supported version, it is not usually desirable to update with the same frequency). And these tools will not add it back since they cannot tell whatever the user wishes to usetoolchain, the "intent" has been removed.The
godirective often gets bump bygo mod tidywhen a dependency requires it, which happens fairly often.The current behavior adds extra work for the user to keep an eye on the presence of the
toolchaindirective in theirgo.modfile, to add it back when there is a new release. Possibly allowing CVEs to accumulate if they do not notice or forget.Basically, when a user has opted into using
toolchain, they should never be opted out bygo mod tidy.Would that sound like reasonable change for
go mod tidy?