Skip to content

Instantly share code, notes, and snippets.

@adamgoose
Created April 30, 2019 08:14
Show Gist options
  • Save adamgoose/4cc8a19af7f890f4825bbf398d24fc81 to your computer and use it in GitHub Desktop.
Save adamgoose/4cc8a19af7f890f4825bbf398d24fc81 to your computer and use it in GitHub Desktop.

VS Code Extensions Worth Installing

Configuring Golang Language Server

Golang is in a transition right now, starting with version 1.11 with the introduction of Golang Modules. Modules are a better approach to dependency management, yielding reproducable builds every time. During this state of flux, some custom components and configuration are necessary to get the best intellisense in VS Code. More details can be found here and here. Definitely click those links, as this guide is in supplement to them.

  • Install the Go VS Code Extension
  • Using Ctrl+Shift+P, run the "Go: Install/Update Tools" command, and check every tool except those that have a *-gomod alternative (only "gocode" at the time of writing).
  • Using Ctrl+Shift+P, run "Developer: Reload Window"
  • From your home directory (not a directory with a go.mod file), run go get -u golang.org/x/tools/cmd/gopls. This installs the gopls binary in your $GOPATH/bin.
  • Add this config to your VS Code settings.json. This tells the VS Code Plugin to use gopls instead of the older components.
  • Using Ctrl+Shift+P, run "Developer: Reload Window"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment