@@ -12,8 +12,13 @@ import (
1212)
1313
1414var minGoVersion = util .NewSemVer ("1.11" )
15+
16+ // This can be increased before a new minor version has been released, based on testing with the release candidates.
1517var maxGoVersion = util .NewSemVer ("1.26" )
1618
19+ // This should be the maximum supported version which has been released.
20+ var goVersionToInstall = util .NewSemVer ("1.26" )
21+
1722type versionInfo struct {
1823 goModVersion util.SemVer // The version of Go found in the go directive in the `go.mod` file.
1924 goEnvVersion util.SemVer // The version of Go found in the environment.
@@ -52,18 +57,18 @@ func getVersionWhenGoModVersionNotFound(v versionInfo) (msg string, version util
5257 // was intended to be used to build this project. Go versions are generally backwards
5358 // compatible, so we install the maximum supported version.
5459 msg = "No version of Go installed and no `go.mod` file found. Requesting the maximum " +
55- "supported version of Go (" + maxGoVersion .String () + ")."
56- version = maxGoVersion
60+ "supported version of Go that has been released (" + goVersionToInstall .String () + ")."
61+ version = goVersionToInstall
5762 diagnostics .EmitNoGoModAndNoGoEnv (msg )
5863 } else if outsideSupportedRange (v .goEnvVersion ) {
5964 // The Go version installed in the environment is not supported. We have no indication
6065 // which version was intended to be used to build this project. Go versions are generally
6166 // backwards compatible, so we install the maximum supported version.
6267 msg = "No `go.mod` file found. The version of Go installed in the environment (" +
6368 v .goEnvVersion .String () + ") is outside of the supported range (" + minGoVersion .String () + "-" +
64- maxGoVersion .String () + "). Requesting the maximum supported version of Go (" + maxGoVersion . String () +
65- ")."
66- version = maxGoVersion
69+ maxGoVersion .String () + "). Requesting the maximum supported version of Go that has " +
70+ "been released (" + goVersionToInstall . String () + " )."
71+ version = goVersionToInstall
6772 diagnostics .EmitNoGoModAndGoEnvUnsupported (msg )
6873 } else {
6974 // The version of Go that is installed is supported. We have no indication which version
@@ -86,9 +91,9 @@ func getVersionWhenGoModVersionTooHigh(v versionInfo) (msg string, version util.
8691 // installed. We install the maximum supported version as a best effort.
8792 msg = "The version of Go found in the `go.mod` file (" + v .goModVersion .String () +
8893 ") is above the supported range (" + minGoVersion .String () + "-" + maxGoVersion .String () +
89- "). No version of Go installed. Requesting the maximum supported version of Go ( " +
90- maxGoVersion .String () + ")."
91- version = maxGoVersion
94+ "). No version of Go installed. Requesting the maximum supported version of Go that has " +
95+ "been released (" + goVersionToInstall .String () + ")."
96+ version = goVersionToInstall
9297 diagnostics .EmitGoModVersionTooHighAndNoGoEnv (msg )
9398 } else if aboveSupportedRange (v .goEnvVersion ) {
9499 // The version in the `go.mod` file is above the supported range. The version of Go that
@@ -108,8 +113,8 @@ func getVersionWhenGoModVersionTooHigh(v versionInfo) (msg string, version util.
108113 ") is above the supported range (" + minGoVersion .String () + "-" + maxGoVersion .String () +
109114 "). The version of Go installed in the environment (" + v .goEnvVersion .String () +
110115 ") is below the supported range (" + minGoVersion .String () + "-" + maxGoVersion .String () +
111- "). Requesting the maximum supported version of Go (" + maxGoVersion .String () + ")."
112- version = maxGoVersion
116+ "). Requesting the maximum supported version of Go that has been released (" + goVersionToInstall .String () + ")."
117+ version = goVersionToInstall
113118 diagnostics .EmitGoModVersionTooHighAndEnvVersionTooLow (msg )
114119 } else if maxGoVersion .IsNewerThan (v .goEnvVersion ) {
115120 // The version in the `go.mod` file is above the supported range. The version of Go that
@@ -119,8 +124,8 @@ func getVersionWhenGoModVersionTooHigh(v versionInfo) (msg string, version util.
119124 ") is above the supported range (" + minGoVersion .String () + "-" + maxGoVersion .String () +
120125 "). The version of Go installed in the environment (" + v .goEnvVersion .String () +
121126 ") is below the maximum supported version (" + maxGoVersion .String () +
122- "). Requesting the maximum supported version of Go (" + maxGoVersion .String () + ")."
123- version = maxGoVersion
127+ "). Requesting the maximum supported version of Go that has been released (" + goVersionToInstall .String () + ")."
128+ version = goVersionToInstall
124129 diagnostics .EmitGoModVersionTooHighAndEnvVersionBelowMax (msg )
125130 } else {
126131 // The version in the `go.mod` file is above the supported range. The version of Go that
0 commit comments