Go: x/tools/gopls: support gopls for 1.12 (current - 4)

Created on 19 May 2020  路  14Comments  路  Source: golang/go

What version of Go are you using (go version)?

$ go version
go version go1.12.17 windows/amd64

Does this issue reproduce with the latest release?

No.

What operating system and processor architecture are you using (go env)?

go env Output

$ go env

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\bwells\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\bwells\go
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\bwells\AppData\Local\Temp\go-build198506238=/tmp/go-build -gno-record-gcc-switches

What did you do?

In VSCode I updated to the latest version of gopls.

What did you expect to see?

Expected to see gopls installed correctly.

What did you see instead?

gopls failed to install due to a dependency on a package which uses a newer go language feature (errors.As) than is available in the version of go I am using (go 1.12).

gopls:
Error: Command failed: C:\Go\bin\go.exe get -v golang.org/x/tools/gopls
Fetching https://golang.org/x/tools/gopls?go-get=1
Parsing meta tags from https://golang.org/x/tools/gopls?go-get=1 (status code 200)
get "golang.org/x/tools/gopls": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/gopls?go-get=1
get "golang.org/x/tools/gopls": verifying non-authoritative meta tag
Fetching https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
golang.org/x/tools/internal/jsonrpc2
# golang.org/x/tools/internal/jsonrpc2
..\..\..\..\..\go\pkg\mod\golang.org\x\[email protected]\internal\jsonrpc2\messages.go:168:5: undefined: errors.As
Fetching https://golang.org/x/tools/gopls?go-get=1
Parsing meta tags from https://golang.org/x/tools/gopls?go-get=1 (status code 200)
get "golang.org/x/tools/gopls": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/gopls?go-get=1
get "golang.org/x/tools/gopls": verifying non-authoritative meta tag
Fetching https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
golang.org/x/tools/internal/jsonrpc2
# golang.org/x/tools/internal/jsonrpc2
..\..\..\..\..\go\pkg\mod\golang.org\x\[email protected]\internal\jsonrpc2\messages.go:168:5: undefined: errors.As
Tools gopls

Most helpful comment

In an ideal world, it would be nice if everyone moves timely to the new thing. But in practice, we know some platform couldn't get rid of 1.9 until recently. Google's Appengine doc is still listing go1.12 https://cloud.google.com/appengine/docs/standard/go/runtime.

And, some users may want to test their software with different versions of Go to check regression or run comparison, and I believe that is a valid use case.

All 14 comments

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

From the Go release policy:

Each major Go release is supported until there are two newer major releases. For example, Go 1.5 was supported until the Go 1.7 release [...]

Since Go1.14 is out, Go1.12 is no longer a supported version; which means that gopls is allowed to break compatibility with it.

I suggest upgrading your Go version.

The obvious solution is for me to upgrade to the latest version, but sadly I can't at the moment.

There is still a community on go 1.12 and it would be nice to know when this happened and what the best course of action would be other than upgrade to the latest go version.

Was advised by @heschik on slack to submit an issue.

Raised an issue on the vscode-go repo for them to at least update their documentation for what versions of go it supports.

Was already submitted here: https://github.com/golang/vscode-go/issues/66

I've vacillated on my stance about supporting older Go versions, but I am now thinking that we should. To do this correctly, we will need to develop a gopls-specific policy like https://golang.org/doc/devel/release.html#policy, and we will need to configure TryBots with older versions of Go to run on golang.org/x/tools. I filed https://github.com/golang/go/issues/39159 to track this work, as this will be the first step.

There is still a community on go 1.12 and it would be nice to know when this happened and what the best course of action would be other than upgrade to the latest go version.

Could you elaborate on this? Widespread use of a release version out of security support is a security concern for the ecosystem and I'd like to understand if there's something we can do to avoid it.

Upgrade to go 1.13 has been a bit of a protracted affair for us partly due to the opt in nature of the google proxy for modules. We are getting to the end of this and hope to upgrade soon.

From what I can see there are still services out there which require running with older versions of go. An example of this is google appengine which only supports go 1.13 as beta functionality.

I suspect that a lot of this is more a packaging problem in that as tools such as gopls are not available as binaries so tools such as vscode-go pull gopls as source and build on the fly. Not sure on the best solution here.

Another thing I was thinking about it that it is not obvious that https://github.com/golang/tools follows the same release policy as https://github.com/golang/go. Perhaps this could be made more obvious by having it documented in https://github.com/golang/tools.

In an ideal world, it would be nice if everyone moves timely to the new thing. But in practice, we know some platform couldn't get rid of 1.9 until recently. Google's Appengine doc is still listing go1.12 https://cloud.google.com/appengine/docs/standard/go/runtime.

And, some users may want to test their software with different versions of Go to check regression or run comparison, and I believe that is a valid use case.

Change https://golang.org/cl/243578 mentions this issue: internal/lsp: support go1.12

Since Go 1.15 will be coming soon, I think we should aim to only support 1.12-1.15 (~current - 4).
https://golang.org/cl/243578 added back support for 1.12, but we aren't likely to maintain it without testing.

I imagine that it will be a while before #39159 is resolved, but in the meantime, @findleyr has said that we can add support for testing different Go versions in our GCB CI system.

Change https://golang.org/cl/250941 mentions this issue: internal/lsp: fix builds and tests for go1.12+

Change https://golang.org/cl/253281 mentions this issue: gopls/doc: add information about supported Go versions

Was this page helpful?
0 / 5 - 0 ratings