Skip to content

Commit 2ca6abe

Browse files
committed
gopls: expand on documentation about version support changes
Users unfamiliar with the subtleties of version support are rightly confused by our current documentation. Try to clarify, by defining terms more precisely and being sure to emphasize that language version support is unchanged. Also, add a section for the new stdversions analyzer, which is not present in [email protected]. For golang/go#67936 Change-Id: Ia9f241da4a67dc0ca82532ae945751ad3c6b6f1f Reviewed-on: https://go-review.googlesource.com/c/tools/+/592576 Reviewed-by: Alan Donovan <[email protected]> Auto-Submit: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent b59dd37 commit 2ca6abe

File tree

2 files changed

+69
-22
lines changed

2 files changed

+69
-22
lines changed

gopls/README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,30 @@ that it officially supports only the two most recent major Go releases. Until
8080
August 2024, the Go team will also maintain best-effort support for the last
8181
4 major Go releases, as described in [issue #39146](https://go.dev/issues/39146).
8282

83-
Starting with the release of Go 1.23.0 and [email protected] in August 2024, the
84-
gopls build will depend on the latest version of Go. However, due to the
85-
[forward compatibility](https://go.dev/blog/toolchain) support added to the
86-
`go` command in Go 1.21, as long as Go 1.21 or later are used to install gopls,
87-
the toolchain upgrade will be handled automatically, just like any other
88-
dependency. Gopls will continue to support integrating with the three most
89-
recent major Go releases of the `go` command. See
90-
[issue #65917](https://go.dev/issue/65917) for more details.
91-
92-
Maintaining support for legacy versions of Go caused
83+
When using gopls, there are three versions to be aware of:
84+
1. The _gopls build go version_: the version of Go used to build gopls.
85+
2. The _go command version_: the version of the go list command executed by
86+
gopls to load information about your workspace.
87+
3. The _language version_: the version in the go directive of the current
88+
file's enclosing go.mod file, which determines the file's Go language
89+
semantics.
90+
91+
Starting with the release of Go 1.23.0 and [email protected] in August 2024, we
92+
will only support the most recent Go version as the _gopls build go version_.
93+
However, due to the [forward compatibility](https://go.dev/blog/toolchain)
94+
support added in Go 1.21, as long as Go 1.21 or later are used to install
95+
gopls, any necessary toolchain upgrade will be handled automatically, just like
96+
any other dependency.
97+
98+
Additionally, starting with [email protected], the _go command version_ will narrow
99+
from 4 versions to 3. This is more consistent with the Go Release Policy.
100+
101+
Gopls supports **all** Go versions as its _language version_, by providing
102+
compiler errors based on the language version and filtering available standard
103+
library symbols based on the standard library APIs available at that Go
104+
version.
105+
106+
Maintaining support for building gopls with legacy versions of Go caused
93107
[significant friction](https://go.dev/issue/50825) for gopls maintainers and
94108
held back other improvements. If you are unable to install a supported version
95109
of Go on your system, you can still install an older version of gopls. The

gopls/doc/release/v0.16.0.md

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,47 @@ version of gopls to support Go 1.23. To install it, run:
1010

1111
## New support policy; end of support for Go 1.19 and Go 1.20
1212

13-
This is the last release of gopls that may be built and used with Go 1.19 or Go
13+
**TL;DR: We are narrowing gopls' support window, but this is unlikely to
14+
affect you as long as you use at least Go 1.21 to build gopls. This doesn't
15+
affect gopls' support for the code you are writing.**
16+
17+
This is the last release of gopls that may be built with Go 1.19 or Go 1.20,
18+
and also the last to support integrating with go command versions 1.19 and
1419
1.20. If built or used with either of these Go versions, it will display
1520
a message advising the user to upgrade.
1621

22+
When using gopls, there are three versions to be aware of:
23+
1. The _gopls build go version_: the version of Go used to build gopls.
24+
2. The _go command version_: the version of the go list command executed by
25+
gopls to load information about your workspace.
26+
3. The _language version_: the version in the go directive of the current
27+
file's enclosing go.mod file, which determines the file's Go language
28+
semantics.
29+
30+
This gopls release, v0.16.0, is the final release to support Go 1.19 and Go
31+
1.20 as the _gopls build go version_ or _go command version_. There is no
32+
change to gopls' support for all _language versions_--in fact this support has
33+
somewhat improved with the addition of the `stdversion` analyzer (see below).
34+
1735
Starting with [email protected], which will be released after Go 1.23.0 is released
18-
in August, installing gopls will require the latest version of the Go
19-
toolchain. Thanks to the [forward compatibility](https://go.dev/blog/toolchain)
36+
in August, gopls will only support the latest version of Go as the
37+
_gopls build go version_.
38+
However, thanks to the [forward compatibility](https://go.dev/blog/toolchain)
2039
added to Go 1.21, any necessary toolchain upgrade should be handled
21-
automatically for users of Go 1.21 or later. This restriction is for _building_
22-
gopls only -- we will continue to support command line integration with the
23-
last three major Go versions. Nonetheless, this is fewer than our previous policy
24-
of gopls supporting the last four major Go versions of installed toolchains.
40+
automatically for users of Go 1.21 or later, just like any other dependency.
41+
Additionally, we are reducing our _go command version_ support window from
42+
4 versions to 3. Note that this means if you have at least Go 1.21 installed on
43+
your system, you should still be able to `go install` and use [email protected].
44+
45+
We have no plans to ever change our _language version_ support: we expect that
46+
gopls will always support developing programs that target _any_ Go version.
2547

26-
See the newly updated
48+
By focusing on building gopls with the latest Go version, we can significantly
49+
reduce our maintenance burden and help improve the stability of future gopls
50+
releases. See the newly updated
2751
[support policy](https://github.com/golang/tools/tree/master/gopls#support-policy)
28-
for details. We expect that this change will significantly reduce our
29-
maintenance burden, and will help improve the stability of future gopls
30-
releases. Please comment on [issue #65917](https://go.dev/issue/65917) if you
31-
have concerns about this change.
52+
for details. Please comment on [issue #65917](https://go.dev/issue/65917) if
53+
you have concerns about this change.
3254

3355
## Configuration Changes
3456

@@ -177,6 +199,17 @@ func (s S) set(x int) {
177199
}
178200
```
179201

202+
### `stdversion` analyzer
203+
204+
The new
205+
[`stdversion`](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion)
206+
analyzer warns about the use of too-new standard library symbols based on the
207+
version of the `go` directive in your `go.mod` file. This improves our support
208+
for older _language versions_ (see above), even when gopls is built with
209+
a recent Go version.
210+
211+
TODO: add a screenshot demonstrating the new diagnostics
212+
180213
### Two more vet analyzers
181214

182215
The [framepointer](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/framepointer)

0 commit comments

Comments
 (0)