diff --git a/gopls/README.md b/gopls/README.md index 5c80965c153..0b5f4ade769 100644 --- a/gopls/README.md +++ b/gopls/README.md @@ -75,19 +75,27 @@ and ### Supported Go versions `gopls` follows the -[Go Release Policy](https://golang.org/doc/devel/release.html#policy), -meaning that it officially supports the last 2 major Go releases. Per -[issue #39146](https://go.dev/issues/39146), we attempt to maintain best-effort -support for the last 4 major Go releases, but this support extends only to not -breaking the build and avoiding easily fixable regressions. - -In the context of this discussion, gopls "supports" a Go version if it supports -being built with that Go version as well as integrating with the `go` command -of that Go version. - -The following table shows the final gopls version that supports a given Go -version. Go releases more recent than any in the table can be used with any -version of gopls. +[Go Release Policy](https://golang.org/doc/devel/release.html#policy), meaning +that it officially supports only the two most recent major Go releases. Until +August 2024, the Go team will also maintain best-effort support for the last +4 major Go releases, as described in [issue #39146](https://go.dev/issues/39146). + +Starting with the release of Go 1.23.0 and gopls@v0.17.0 in August 2024, the +gopls build will depend on the latest version of Go. However, due to the +[forward compatibility](https://go.dev/blog/toolchain) support added to the +`go` command in Go 1.21, as long as Go 1.21 or later are used to install gopls, +the toolchain upgrade will be handled automatically, just like any other +dependency. Gopls will continue to support integrating with the two most recent +major Go releases of the `go` command, per the Go Release Policy. See +[issue #65917](https://go.dev/issue/65917) for more details. + +Maintaining support for legacy versions of Go caused +[significant friction](https://go.dev/issue/50825) for gopls maintainers and +held back other improvements. If you are unable to install a supported version +of Go on your system, you can still install an older version of gopls. The +following table shows the final gopls version that supports a given Go version. +Go releases more recent than those in the table can be used with any version of +gopls. | Go Version | Final gopls version with support (without warnings) | | ----------- | --------------------------------------------------- | @@ -95,12 +103,7 @@ version of gopls. | Go 1.15 | [gopls@v0.9.5](https://github.com/golang/tools/releases/tag/gopls%2Fv0.9.5) | | Go 1.17 | [gopls@v0.11.0](https://github.com/golang/tools/releases/tag/gopls%2Fv0.11.0) | | Go 1.18 | [gopls@v0.14.2](https://github.com/golang/tools/releases/tag/gopls%2Fv0.14.2) | - -Our extended support is enforced via [continuous integration with older Go -versions](doc/contributing.md#ci). This legacy Go CI may not block releases: -test failures may be skipped rather than fixed. Furthermore, if a regression in -an older Go version causes irreconcilable CI failures, we may drop support for -that Go version in CI if it is 3 or 4 Go versions old. +| Go 1.20 | [gopls@v0.15.3](https://github.com/golang/tools/releases/tag/gopls%2Fv0.15.3) | ### Supported build systems diff --git a/gopls/internal/util/goversion/goversion.go b/gopls/internal/util/goversion/goversion.go index 5b849b22b85..8353487ddce 100644 --- a/gopls/internal/util/goversion/goversion.go +++ b/gopls/internal/util/goversion/goversion.go @@ -40,7 +40,9 @@ var Supported = []Support{ {15, "", "v0.9.5"}, {16, "", "v0.11.0"}, {17, "", "v0.11.0"}, - {18, "v0.16.0", "v0.14.2"}, + {18, "", "v0.14.2"}, + {19, "v0.17.0", "v0.15.3"}, + {20, "v0.17.0", "v0.15.3"}, } // OldestSupported is the last X in Go 1.X that this version of gopls diff --git a/gopls/internal/util/goversion/goversion_test.go b/gopls/internal/util/goversion/goversion_test.go index f48ef5008c8..e2df9f23118 100644 --- a/gopls/internal/util/goversion/goversion_test.go +++ b/gopls/internal/util/goversion/goversion_test.go @@ -40,20 +40,18 @@ func TestMessage(t *testing.T) { } } - tests := []struct { - goVersion int - fromBuild bool - wantContains []string // string fragments that we expect to see - wantIsError bool // an error, not a mere warning - }{ + tests := []test{ {-1, false, nil, false}, deprecated(12, "v0.7.5"), deprecated(13, "v0.9.5"), deprecated(15, "v0.9.5"), deprecated(16, "v0.11.0"), deprecated(17, "v0.11.0"), - {18, false, []string{"Found Go version 1.18", "unsupported by gopls v0.16.0", "upgrade to Go 1.19", "install gopls v0.14.2"}, false}, - {18, true, []string{"Gopls was built with Go version 1.18", "unsupported by gopls v0.16.0", "upgrade to Go 1.19", "install gopls v0.14.2"}, false}, + deprecated(18, "v0.14.2"), + {19, false, []string{"Found Go version 1.19", "unsupported by gopls v0.17.0", "upgrade to Go 1.21", "install gopls v0.15.3"}, false}, + {19, true, []string{"Gopls was built with Go version 1.19", "unsupported by gopls v0.17.0", "upgrade to Go 1.21", "install gopls v0.15.3"}, false}, + {20, false, []string{"Found Go version 1.20", "unsupported by gopls v0.17.0", "upgrade to Go 1.21", "install gopls v0.15.3"}, false}, + {20, true, []string{"Gopls was built with Go version 1.20", "unsupported by gopls v0.17.0", "upgrade to Go 1.21", "install gopls v0.15.3"}, false}, } for _, test := range tests {