skip to Main Content

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.0ngo/pkg/mod/golang.org/x/tools/[email protected]/internal/lsp/source/options.go:25:2: //go:build comment without // +build commentn"
}

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 ?

2

Answers


  1. Chosen as BEST ANSWER

    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/[email protected]
    

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

    "go.toolsManagement.checkForUpdates": "off"
    

  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search