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

Open
stamblerre opened this issue Jun 16, 2020 · 0 comments
Open

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

stamblerre opened this issue Jun 16, 2020 · 0 comments

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 16, 2020

For full context, see https://blog.golang.org/generics-next-step.

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 https://go.googlesource.com/go
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 golang.org/x/tools/gopls@dev.go2go golang.org/x/tools@dev.go2go

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.