2

I'm running go1.16, the latest gopls version is not compabtible with it. Confirmed it at https://github.com/golang/tools/blob/master/gopls/README.md. The installation fails with below error

Installing golang.org/x/tools/gopls@latest FAILED
{
 "code": 1,
 "killed": false,
 "signal": null,
 "cmd": "/usr/local/bin/go install -v golang.org/x/tools/gopls@latest",
 "stdout": "",
 "stderr": "go: downloading golang.org/x/tools v0.12.0\ngo/pkg/mod/golang.org/x/tools/gopls@v0.13.1/internal/lsp/source/options.go:25:2: //go:build comment without // +build comment\n"
}

1 tools failed to install.

I want to use vscode to install a version that is compatible, for example v0.12.4.

I can get it to work by manually installing it, is there a way to configure the version for gopls in vscode ?

  • From the Gopls page you linked to: https://github.com/golang/tools/releases/tag/gopls%2Fv0.11.0. At the bottom is an archive of the source code. But it would be easier to just update your Go toolchain. – Kurtis Rader Aug 10 '23 at 00:06
  • The source code there is for gopls. Technically, I could use the same suggestion for the go-extension; still it is not worth the effort. There gotta be a better way! – Balakumar Subramani Aug 14 '23 at 17:22

2 Answers2

0

Currently(at least under my comprehension), if you want to rollback to specific version of any vscode extension, you can go to the extension page and click the dropdown to find Install another version. Extension Go in extension page

ntutm0922
  • 23
  • 4
0

At the moment, there is no option to configure tool versions in vscode-go. It blindly picks the latest version available for gopls. A version is not set here or here.

Only option is to manually install a lower version. Highest gopls version that work with go1.16 is v0.12.4, install it with below command,

go install golang.org/x/tools/gopls@v0.12.4

And disable check for updates with below setting. The extension currently check updates only for gopls.

"go.toolsManagement.checkForUpdates": "off"