This is somewhat related to the recent discussion in #77653, but I think this would be nice to do regardless of whatever the conclusion might be for #77653.
Background
For open source libraries that intend to be used by the general ecosystem, there has been somewhat of an understanding that it is best for them to support at least the two officially supported versions of Go -- that is, the two newest major release versions of 1.N and 1.N-1, such as Go 1.26 and Go 1.25 currently.
Some open source libraries choose to support more than that, and some open source libraries might choose to support less than that, but the norm is often at least the 2 most recent versions if the intent is for an open source library to be widely used.
This choice became much more important due to the nice forward compatibility enhancements in #57001 ("proposal: extended forwards compatibility for Go").
During that conversation, one thing I had suggested was:
One thing to think about might be something official or some semi-official statement from the Go project about expected norms for an open source project in terms of how quickly new Go semantics are adopted (that is, how quickly a project's go line is updated), especially for public modules consumed as libraries, tools that appear within go.mod files, and so on. That might help it not be too fast, as well as help reduce debate on various open source issue trackers about when to update.
I think Russ seemed to agree with that:
A statement about expected norms in docs sounds good.
Examples of on-going confusion
This is still a fairly common topic on open source projects (for example, as people open up drive-by PRs or debate what it should be in sometimes long and often confusing discussions on an issue).
One area of related confusion I still see is around the exact meaning of something like go 1.25 in a go.mod file (without a patch number), and whether that is preferable to something like go 1.25.0, vs. whether they should pick something like go 1.25.7 or similar just because that is the latest available patch release.
Some quick probably representative examples:
kubernetes/kubernetes#137027 -- opened two weeks ago, issue suggests k8s should use go 1.25 in its go.mod files instead of go 1.25.0; k8s maintainer says better to do go 1.25.0 but also I think part of the response might be slightly incorrect in saying "no actual difference".
nats-io/nats-server#6530 -- some confusing discussion, also observes setup-go action authors seem to be applying a different interpretation of what go 1.22 in a go.mod means (and interpreting it as the latest available patch release, which is not what cmd/go does).
DataDog/datadog-agent#29340 -- somewhat confusing discussion of meaning and what should be done.
cli/cli#9489 -- somewhat confusing discussion of meaning and what should be done.
Suggestion
I think it would be nice to make a crisp official recommendation for what an open source Go library should do for its go version directive in its go.mod if it intends to be widely used, and we can then place it in the official documentation (ideally in a ~couple of places that are easy to find).
Let's initially set aside for now the exact wording and where it should be documented given that can be worked out after there is some level of agreement on what the recommendation should be.
Spot checking x/net and x/crypto, the last three go versions in their go.mod files seem to be go 1.23.0, go 1.24.0, and go 1.25.0.
That's probably reasonable as a model to follow -- support at least the 1.N and 1.N-1 Go releases, and default to recording the version using a .0 patch, unless there is some reason not to do so (e.g., if the library relies on a specific fix in a specific Go patch release, or if some required dependency already requires a higher patch, and so on).
There is a little bit of nuance around making sure it is seen as a recommendation and that individual projects might choose a different approach, but that exact nuance also probably can be hammered out along with the exact wording.
Alternative recommendations
Some perhaps less desirable alternatives:
-
pick a fixed patch release that is not .0, like always doing something like go 1.25.1 or go 1.25.3 given some people are averse to .0 releases. However, this might be too arbitrary, and might send the wrong message about .0 releases.
-
have a ~dynamic recommendation to use the latest patch release version that exists whenever the next major release happens (so something like go 1.25.7 if that was the latest patch release available when go1.26.0 was released). This version could be documented in some location and updated every major release. However, this might be too complicated and might also send the wrong message about .0 releases.
Finally, maybe this is already crisply documented somewhere, in which case maybe we should popularize it a bit more and maybe document it in a ~couple more places. 😅
CC @matloob @dmitshur
This is somewhat related to the recent discussion in #77653, but I think this would be nice to do regardless of whatever the conclusion might be for #77653.
Background
For open source libraries that intend to be used by the general ecosystem, there has been somewhat of an understanding that it is best for them to support at least the two officially supported versions of Go -- that is, the two newest major release versions of 1.N and 1.N-1, such as Go 1.26 and Go 1.25 currently.
Some open source libraries choose to support more than that, and some open source libraries might choose to support less than that, but the norm is often at least the 2 most recent versions if the intent is for an open source library to be widely used.
This choice became much more important due to the nice forward compatibility enhancements in #57001 ("proposal: extended forwards compatibility for Go").
During that conversation, one thing I had suggested was:
I think Russ seemed to agree with that:
Examples of on-going confusion
This is still a fairly common topic on open source projects (for example, as people open up drive-by PRs or debate what it should be in sometimes long and often confusing discussions on an issue).
One area of related confusion I still see is around the exact meaning of something like
go 1.25in a go.mod file (without a patch number), and whether that is preferable to something likego 1.25.0, vs. whether they should pick something likego 1.25.7or similar just because that is the latest available patch release.Some quick probably representative examples:
kubernetes/kubernetes#137027 -- opened two weeks ago, issue suggests k8s should use
go 1.25in its go.mod files instead ofgo 1.25.0; k8s maintainer says better to dogo 1.25.0but also I think part of the response might be slightly incorrect in saying "no actual difference".nats-io/nats-server#6530 -- some confusing discussion, also observes setup-go action authors seem to be applying a different interpretation of what
go 1.22in a go.mod means (and interpreting it as the latest available patch release, which is not what cmd/go does).DataDog/datadog-agent#29340 -- somewhat confusing discussion of meaning and what should be done.
cli/cli#9489 -- somewhat confusing discussion of meaning and what should be done.
Suggestion
I think it would be nice to make a crisp official recommendation for what an open source Go library should do for its
goversion directive in its go.mod if it intends to be widely used, and we can then place it in the official documentation (ideally in a ~couple of places that are easy to find).Let's initially set aside for now the exact wording and where it should be documented given that can be worked out after there is some level of agreement on what the recommendation should be.
Spot checking x/net and x/crypto, the last three
goversions in their go.mod files seem to bego 1.23.0,go 1.24.0, andgo 1.25.0.That's probably reasonable as a model to follow -- support at least the 1.N and 1.N-1 Go releases, and default to recording the version using a
.0patch, unless there is some reason not to do so (e.g., if the library relies on a specific fix in a specific Go patch release, or if some required dependency already requires a higher patch, and so on).There is a little bit of nuance around making sure it is seen as a recommendation and that individual projects might choose a different approach, but that exact nuance also probably can be hammered out along with the exact wording.
Alternative recommendations
Some perhaps less desirable alternatives:
pick a fixed patch release that is not
.0, like always doing something likego 1.25.1orgo 1.25.3given some people are averse to.0releases. However, this might be too arbitrary, and might send the wrong message about.0releases.have a ~dynamic recommendation to use the latest patch release version that exists whenever the next major release happens (so something like
go 1.25.7if that was the latest patch release available when go1.26.0 was released). This version could be documented in some location and updated every major release. However, this might be too complicated and might also send the wrong message about.0releases.Finally, maybe this is already crisply documented somewhere, in which case maybe we should popularize it a bit more and maybe document it in a ~couple more places. 😅
CC @matloob @dmitshur