Change-Id: I4c070a5fe06910f6a77ad8de28a31340b9986bb6
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/236747
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
3 files changed
tree: e605a02f68d8a7b593c8b47d0d91aea829711746
  1. .github/
  2. .vscode/
  3. build/
  4. docs/
  5. images/
  6. languages/
  7. snippets/
  8. src/
  9. syntaxes/
  10. test/
  11. typings/
  12. .editorconfig
  13. .gitignore
  14. .prettierrc.json
  15. .travis.yml
  16. .vscodeignore
  17. CHANGELOG.md
  21. package-lock.json
  22. package.json
  23. README.md
  24. thirdpartynotices.txt
  25. tsconfig.json
  26. tslint.json

Go for Visual Studio Code


This extension provides rich language support for the Go programming language in VS Code.

Take a look at the Changelog to learn about new features.

This is the future home for the VS Code Go extension. We are currently migrating from the original repository. Read the announcement to learn about the transition and subscribe to Microsoft/vscode-go#3247 for updates.


Getting started

Welcome! Whether you are new to Go or an experienced Go developer, we hope this extension will fit your needs and enhance your development experience.

Install Go

Before you start coding, make sure that you have already installed Go, as explained on the Go installation guide. If you are unsure, open the Command Palette in VS Code (Ctrl+Shift+P) and run the Go: Locate Configured Go Tools command. If the GOROOT output is empty, you are missing a Go installation. For help installing Go, ask a question on the #newbies Gophers Slack channel.

Set up your environment

Read about Go code organization to learn how to configure your environment. This extension works in both GOPATH and module modes. We suggest using modules, as they are quickly becoming the new standard in the Go community.

Here are some additional resources for learning about how to set up your Go project:

NOTE: If you are using modules, we recommend using the Go language server, which is explained below.

Install the extension

If you haven't already done so, install and open Visual Studio Code. Navigate to the Extensions pane (Ctrl+Shift+X). Search for “Go” and install this extension (the publisher ID is “golang.Go”).

Activate the Go extension

To activate the extension, open any directory or workspace containing Go code.

You should immediately see a prompt in the bottom-right corner of your screen titled Analysis Tools Missing. This extension relies on a suite of command-line tools, which must be installed separately from the extension. Accept the prompt, or use the Go: Install/Update Tools command to pick which tools you would like to install. Note that you must have git installed.

Start coding

You're ready to Go!

Be sure to learn more about the many features of this extension, as well as how to customize them. See Troubleshooting, FAQ, and Resources for further guidance.


This extension has a wide range of features, including Intellisense, code navigation, and code editing support, as well as build, vet, and lint diagnostics as you work. The VS Code Go extension also provides enhanced support for testing and debugging your programs. For more detail, see the full feature breakdown.

In addition to integrated editing features, the extension also provides several commands for working with Go files. You can access any of these by opening the Command Palette (Ctrl+Shift+P) and typing in the name of the command. See the full list of commands provided by the extension.

The majority of the extension‘s features are provided by command-line tools written in Go. If you’re having an issue with a specific feature, you may want to investigate the underlying tool. You can do this by taking a look at the full list of the tools this extension depends on.


Debugging is a major feature offered by this extension. For information on how to debug your Go program, please see the Debugging Guide. It includes information about debugging on Windows Subsystem for Linux (WSL) and remote debugging.


This extension needs no configuration; it works out of the box. However, you may wish to modify your experience.

Many of the features are configurable to your preference. The list of settings can be found in Settings and Commands documentation.


A commonly customized feature is the linter, which is a tool used to provide coding style feedback and suggestions. By default, this extension uses the official golint.

However, you are welcome to use more advanced options like staticcheck, golangci-lint, or revive. This can be configured via the "go.lintTool" setting, and the different options are explained more thoroughly in the list of diagnostic tools.


Advanced users may want to set different GOPATHs for different projects or install the Go tools to a different GOPATH. This is possible and explained in the GOPATH documentation.

Language Server

The Go extension uses a suite of command-line tools to provide language features. A new alternative is to use a single language server, which provides the same features using the Language Server Protocol.

The Go team at Google has developed gopls, which is the official Go language server. It is currently in an alpha state and under active development.

gopls is recommended for projects that use Go modules, as it provides much better support.

To opt-in to the language server, set "go.useLanguageServer" to true in your settings. You should then be prompted to install gopls. If you are not prompted, you can install gopls manually by running the Go: Install/Update Tools command and selecting gopls.

For more information, see the gopls documentation.


If you're having issues with this extension, please reach out to us by filing an issue or asking a question on the Gophers Slack. We hang out in the #vscode channel!

Take a look at learn.go.dev and golang.org/help for additional guidance.


We welcome your contributions and thank you for working to improve the Go development experience in VS Code. If you would like to help work on the VS Code Go extension, please see our Contribution guide. It explains how to build and run the extension locally, as well as the process of sending a contribution.

Code of Conduct

This project follows the Go Community Code of Conduct. If you encounter an issue, please mail conduct@golang.org.