Visual Studio Code

Setting up VS Code to use Go 1.18beta2 is fairly straight-forward:

Update the Go language server

VS Code uses the Go language server, gopls, for dot completion, validating the source code, etc. Suffice it to say, for VS Code to function correctly with Go 1.18beta2, the Go language server needs to know about Go 1.18beta2. To update gopls, please follow the commands below:

  1. Open a console window.

  2. Execute the following command:

    1. go install golang.org/x/tools/gopls@latest

Configure GOROOT

Now that the language server is updated, we can configure VS Code to use Go 1.18beta2:

  1. Open up a console window.

:warning: Please note the next step assumes the go program is 1.18beta2, which it should be if the instructions in the previous section were followed.


  1. Execute the following command:

    1. go env GOROOT
  2. Write down the path printed by the above command.

  3. Open VS Code’s preferences/settings.

  4. Search for GOROOT

  5. Click on Edit in settings.json

  6. Modify or add the property go.goroot and set it to the directory recorded up above.

Voilá, VS Code should now be able to sucessfully handle Go 1.18beta2 code, including generics!


Next: Hello world