Skip to content

Commit

Permalink
gopls: warn about Go 1.19 and Go 1.20
Browse files Browse the repository at this point in the history
Update the support table to warn when users install gopls with Go 1.19
or 1.20, or have these older Go versions in their PATH.
Clarify current and future support in the README.

Fixes golang/go#50825
Updates golang/go#65917

Change-Id: I99de1a7717a8cf99cae1a561ced63e9724dfff66
Reviewed-on: https://go-review.googlesource.com/c/tools/+/588763
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
  • Loading branch information
findleyr committed Jun 3, 2024
1 parent 58cc8a4 commit 018d3b2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
41 changes: 22 additions & 19 deletions gopls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,35 @@ 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) |
| ----------- | --------------------------------------------------- |
| Go 1.12 | [gopls@v0.7.5](https://github.com/golang/tools/releases/tag/gopls%2Fv0.7.5) |
| 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

Expand Down
4 changes: 3 additions & 1 deletion gopls/internal/util/goversion/goversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions gopls/internal/util/goversion/goversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 018d3b2

Please sign in to comment.