-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
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?