Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: working with the go2go generics prototype #39619

stamblerre opened this issue Jun 16, 2020 · 0 comments

x/tools/gopls: working with the go2go generics prototype #39619

stamblerre opened this issue Jun 16, 2020 · 0 comments


Copy link

@stamblerre stamblerre commented Jun 16, 2020

For full context, see

gopls can be made to work with the generics prototype. It will work with any editor that recognizes .go2 as a Go file extension.

As of 06/16/2020, the only way to do this is by installing a special version of the VS Code Go extension. This issue will be updated as other editors begin to support this.

Follow these instructions to build and use gopls with the dev.go2go branch of Go.

Build go

First, build Go at this branch from source:

git clone
cd go
git checkout dev.go2go
(cd src && ./make.bash)

Make sure that this version of go is first on your PATH. Confirm by running go version.
Next, using that version of go, install the dev.go2go-compatible version of gopls:

Build gopls

GO111MODULE=on go get

Install a go2-version of the VS Code Go extension

The final step will be to configure your editor to recognize .go2 files. You can do this by installing a special version of the VS Code Go extension that can translate between .go and .go2 files.

This extension is distributed as a .vsix file and can be found in the dev.go2go VS Code Go release. Download go-nightly-0.0.0.vsix and manually install the extension by following these steps:

  1. Open a VS Code window and navigate to the Extensions View.
  2. Disable or uninstall the default Go extension. Note: You will need to undo this when you want to return to your normal development flow.
  3. Click on the "..." in the top-right corner, select "Install from VSIX...", and choose go-nightly-0.0.0.vsix. Alternatively, you can run code --install-extension path/to/go.vsix or open the Command Palette and run the Extensions: Install from VSIX... command.


If it's not working, make sure that your version of Go in VS Code is the dev.go2go version you built.
You can check the version in the gopls (server) output logs (View: Toggle Output -> Tasks -> gopls (server)).
You can also explicitly specify the path to the go version in your settings.json file:

"go.alternateTools": {
 	"go": "/path/to/go/bin/go"
@gopherbot gopherbot added this to the Unreleased milestone Jun 16, 2020
@stamblerre stamblerre added Thinking gopls and removed gopls labels Jun 16, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Jun 17, 2020
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jul 31, 2020

Disable the fillstruct analysis by default.
We recently uncovered some performance issues with the analysis, leading us to disable it by default.
Once those issues are resolved, we will enable it by default again.
You can still enable it by adding the following to your VS Code settings:

"gopls": {
	"analyses": {
		"fillstruct": true,


    Significant memory improvements (@heschik). Dependency test variants and vendored packages are no longer considered "workspace packages".
    Smart autocompletion for "append" (@muirdm).
    A "fill struct" code action to suggest populating a struct literal with default values (@luciolas, @joshbaum).
    Better cgo support with Go 1.15 (@heschik). Learn more: golang/go#35721 (comment).
    Code lens to run Go tests directly in the editor (@martskins). Currently opt-in:

"gopls": {
    "codelens": {
        "test": true,

    Improved folding in composite literals (@joshbaum).
    Pop-up suggestion to run go mod vendor when inconsistent vendoring detected (@stamblerre).
    Respect GOPRIVATE for all document links and links on hover (@findleyr).
    A full list of issues resolved in this release can be found in the gopls/v0.4.2 milestone.

gopls/dev.go2go: You can use the new go2go prototype with gopls. See golang/go#39619.
@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants