Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: cmd/go: refine the default language version based on context #36875
In https://groups.google.com/g/golang-dev/c/j3d8zuauJoY/m/gPOgpq_5DgAJ, @griesemer noted (emphasis mine):
I agree with that assessment. However, I think there is a better default we could use in order to move forward with less churn: rather than having the Go language version used for dependencies track the maximum version supported by the Go toolchain (as it has in the past), we should have it default to a version that is likely to be compatible with existing code that was written for use in
I propose that
Note that in all cases users can explicitly override the default by passing
Defaulting to Go 1.14 for packages outside of the main module in module mode maintains compatibility for packages written prior to the introduction of modules, even when they are loaded in module mode.
Defaulting to the maximum supported language version for file lists in module mode encourages users of standalone “script” files to either keep them up to date with language changes, or explicitly record the intended version in a corresponding
Defaulting to the maximum supported language version in
See also #30791.
I think this is a great idea. I almost suggested something similar in my already-too-long reply to Robert, but swapping 1.14 for 1.12 - the first version that introduced the concept of language versions. I imagine nothing should break by advancing those two language versions.
FWIW, I think this is important and I have suggested this in the past. (And I was just typing a response to the golang-dev thread to suggest it again, including using
Very important to note that, while at some point in the future we plan to make a backwards-incompatible version of Go, that is still aways off. Among other things it cannot happen until GOPATH is no longer used at all. So while you are right that we need to consider this before then, Go 1.15 is not going to be the "first break".