[latest] v0.17.2

b6fe8e2 [release] src/goEnvironmentStatus.ts: clear pre-installed terminal PATH mutation
c71e9ce [release] CHANGELOG.md: v0.17.2
d9187fe [release] src/goInstallTools.ts: add GOROOT/bin to PATH when it wasn't found from PATH
a42b5de [release] v0.17.1 CHANGELOG and prep
20ba7a5 [release] src/goInstallTools.ts: mutate PATH only when necessary
dfdd910 [release] src/goInstallTools.ts: return a rejected promise when go isn't found
292b78f [release] src/goLanguageServer.ts: include sanitized trace to issue report
f78c016 [release] package.json: default 'go.coverMode' to be 'default'
8b166d9 [release] release: fix CHANGELOG.md
8439353 [release] 0.17.0 CHANGELOG
dfefea0 [release] debugAdapter: fix a bug where we are not sending back configuration done response
6f67a37 [release] src/goDebugConfiguration.ts: add resolveDebugConfiguration back
be02aa1 [release] test/gopls: fix completion middleware test
bbadf55 [release] build/all.bash: build vscode-test-env from the root
47a7452 [release] prepare v0.17.0 release
322e058 0.16.2 release CHANGELOG
368fc43 src/util.ts: allow getGoVersion when there is no active text editor
c23df8f src/goLanguageServer.ts: restart if go.toolsEnvVars changes
f8bce8c src/goBuild: remove misleading error message in modules mode
dcea773 src/goCover.ts: correct windows absolute filepath handling
02869c8 src/goPackages.ts: pass GOROOT to gopkgs
0b32079 docs/switch-version.md: add Go version switching documentation
1080e21 src/util.ts,goLanguageServer.ts: set cwd for cp.execFile
d594eec build: add setup_env to all.bash and update contributing.md
c705adf src/goInstallTools: report `go env` failure
f2fd351 src/debugAdapter: make filepaths in errors absolute
52260e0 src/goCover.ts: provide explicit directory for running go list
859bb8a src/goTools.ts: recognize gofumpt, gofumports formatters
d05379e test/integration: increase extension test timeout
43d6d04 package.json: let some commands activate extension
5a7752c src/debugAdapter: add delve 'call' command support
575abde src/goEnvironmentStatus: fix PATH mutation logic in osx
77bda0a test/gopls: print gopls traces when test fails
2c287db src/goDebugConfiguration: expand '~' in cwd attribute
bd77a6f src/testUtils.ts: always run test in package list mode
a7b1705 test/integration: add extra tests for env var combining
3ffb96e src/goCover: remove obsolete go.coverageDecorator support
da7328b package.json: disable debug config's showGlobalVariables by default
4b52e43 package.json: disable go.installDependenciesWhenBuilding by default
c7c4188 src/goDebugConfiguration: combine envFile and env
cd41bd1 .github/workflows, build: install dlv in containers
c169d13 src/utils/envUtils.ts: add parseEnvFiles
eeb2512 src/utils: move env var utilities to its own module
95570ec goLanguageServer: attach gopls version to issue reports
e15a8a2 docs: link to more VS Code docs, add alternative ways to start
8f16fe4 tools/generate.go: add defaults and enums to settings.md
9167ad2 docs: add stdlib.md
7f493bf src/goEnvironmentStatus.ts: notify user of available Go updates
1e4dbe2 src/testUtils.ts: fix parsing of the compiler error file expansion
47e2496 docs: fix out-of-sync documentation
139fd7d src/goCover.go: add go.coverMode to display coverage data and counts
d41272c src/util.ts: log `go version` output
6aa134d src/goInstallTools.ts: fix the installation failure message
e1603dd package.json: allow additional properties for alternateTools
56f2f9e src/goLanguageServer.ts: update middleware arguments to match gopls
5089f49 build,.github/workflows: use go1.15
2bd6cd6 docs: expand debugging instructions
f4f147c build: add line breaks to build/Dockerfile
116a0a0 package.json: prepare for 0.17.0 dev
bc9db1e CHANGELOG.md: cherry-pick v0.16.1 CHANGELOG update
aabbc51 src/goLanguageServer.ts: add config to overwrite vscode-go codelens
bec9cf3 src/testUtil.ts: switch to -json mode only if -v is set
9bdb768 build,.github/workflows: install all tools in modules mode
f9c0454 src/debugAdapter2: launch as an external process, and fix config
c3f97ff goLanguageServer: change survey prompt probability to 2.75%
d1404a0 src/goLanguageServer.ts: handle missing filterText in completion items
6a84918 src/goEnv.ts: readd go.toolsEnvVars variable substitution
c6695aa src/goMain.ts: reinstate the goroot var interpolation
c22bbe5 CHANGELOG.md: v0.16.0 release note
9523e4b src/goInstallTools.ts: avoid type check error
18eaf7e src/goEnvironmentStatus.ts: ignore uninstalled Go on network failure
fe3c6b5 package.json: require vscode 1.46 or up
9d1620b src/goLanguageServer.ts: add "debug test" and "debug benchmark" codelens
e3aa3a2 src: npm run fix-lint
d8f9560 src/goEnvironmentStatus.ts: handle failed getGoVersion call
dc9de1c src/util.ts: attempt to fix version parsing again
bd41c5e src/goLanguageServer.ts: fix broken event forwarding in middleware

Change-Id: Ice07a56a544c4bb2f17c4da28d5865695bac3fc4
tree: 4bdb01859f1b39750bd3a738052cfd558447ce15
  1. .editorconfig
  2. .github/
  3. .gitignore
  4. .prettierrc.json
  5. .vscode/
  6. .vscodeignore
  7. CHANGELOG.md
  8. CODE_OF_CONDUCT.md
  9. LICENSE
  10. README.md
  11. SECURITY.md
  12. build/
  13. docs/
  14. images/
  15. languages/
  16. package-lock.json
  17. package.json
  18. snippets/
  19. src/
  20. syntaxes/
  21. test/
  22. third_party/
  23. tools/
  24. tsconfig.json
  25. tslint.json
  26. typings/
  27. webpack.config.js
README.md

Go for Visual Studio Code

Slack

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 new home for the VS Code Go extension. We just migrated from Microsoft/vscode-go. Learn more about our move on the Go blog.

Overview

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 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.

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.

More advanced users may be interested in using different GOPATHs or Go versions per-project. You can learn about the different GOPATH manipulation options in the GOPATH documentation. Take a look at the other customization options as well.

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. 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.

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. Take a look at Troubleshooting and Help for further guidance.

Support for Go modules

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.

In general, we recommend using gopls, the official Go language server, if you are using modules. Read more below and in the gopls documentation.

Features

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

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.

Customization

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.

Linter

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.

GOPATH

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

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 "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.

Ask for help

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.

Preview version

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.

Contributing

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.

Code of Conduct

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

License

MIT