|author||Hana <email@example.com>||Thu Jan 21 09:41:15 2021 -0500|
|committer||Hyang-Ah Hana Kim <firstname.lastname@example.org>||Thu Jan 21 21:46:03 2021 +0000|
[release] src/goLanguageServer: partial revert of cl/280601 This partially reverts commit 4c91c3874bccaf659af616627ba1deefc3a35667. In https://go-review.googlesource.com/c/vscode-go/+/280601, we tried to remove the languageServerExperimentalFeatures setting because gopls's diagnostics feature is no longer in its experimental state and that was the only flag left in this setting. However, we learned some users depend on this flag because the extension turns off buildOnSave and vetOnSave features when gopls's diagnostics is used and they need to run custom vet analyzers. This is not ideal and the extension shouldn't prevent users from running their custom analyzers. That needs more investigation and experiment. For now, we rollback the change, but place the deprecation notice. Update golang/vscode-go#50 Fixes golang/vscode-go#1110 Change-Id: I376692b152d3011aaa8da7a1b5121ba33e2188b6 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/285253 Trust: Hyang-Ah Hana Kim <email@example.com> Run-TryBot: Hyang-Ah Hana Kim <firstname.lastname@example.org> TryBot-Result: kokoro <email@example.com> Reviewed-by: Rebecca Stambler <firstname.lastname@example.org> (cherry picked from commit fbd2fc4f132461fc4ed62e0fe6e48a0b68f55a56) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/285256
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.
📣 We plan to enable the language server (
gopls) by default in early 2021. The language server provides language features like intellisense, formatting, refactoring, analysis and many more. We recommend switching to the language server now (
"go.useLanguageServer": true) to confirm it works well for you. Please file a new issue if you notice bugs or missing features.
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.
Before you start coding, make sure that you have already installed Go, as explained in the Go installation guide.
If you are unsure whether you have installed Go, 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.
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 the new standard and become default from go 1.16 (to be released in early 2021).
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.
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
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. Accept the prompt, or use the
Go: Install/Update Tools command to pick which tools you would like to install.
If you see an error that looks like
command Go: Install/Update Tools not found, it means that the extension has failed to activate and register its commands. Please uninstall and then reinstall the extension.
When the extension is active, you should see the Go status bar in the bottom left corner.
You're ready to Go!
Go modules have added a lot of complexity to the way that most tools and features are built for Go. Some, but not all, features of this extension have been updated to work with Go modules. Some features may also be slower in module mode. The features documentation contains more specific details.
This extension has a wide range of features, including Intellisense, code navigation, and code editing support. It also shows build, vet, and lint diagnostics as you work and 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 functionality comes from command-line tools. If you’re experiencing 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 tools used by this extension.
Debugging is a major feature offered by this extension. For a comprehensive overview of how to debug your Go programs, please see the debugging guide.
This extension needs no configuration; it works out of the box. However, you may wish to modify settings to adjust your experience.
Many of the features are configurable to your preference. A few common modifications are mentioned below, but take a look at the full list of settings for an overview.
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
However, you are welcome to use more advanced options like
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
In the default mode, the Go extension relies upon a suite of command-line tools. A new alternative is to use a single language server, which provides language features through 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.
To opt-in to the language server, set
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
For more information, see the
If you'd like to get early access to new features and bug fixes, you can use the nightly build of this extension. Learn how to install it in by reading the Go Nightly documentation.
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, and it describes the process of sending a contribution.