Go for VS Code: gopls, Debugging, Diagnostics
The Go for Visual Studio Code extension is the official Go tooling integration for VS Code, kept up by the engineering team behind Go's own toolchain, not a community fork. Reach for it if you live in VS Code and want gopls-driven completion, build/vet diagnostics, and Delve debugging wired together out of the box. Skip it if you need an editor VS Code doesn't cover.
What is the Go for VS Code Extension?
The Go for Visual Studio Code extension adds Go language support to VS Code: gopls-backed completion, symbol lookup, formatting, inline build/vet/lint diagnostics, and integrated testing and debugging. It hands language analysis to gopls and step-through debugging to Delve rather than reimplementing that logic itself. It activates automatically the first time you open a .go or go.mod file.
Who is the Go for VS Code Extension for?
The Go for VS Code extension fits developers who already write Go and want VS Code to behave like a Go-aware editor rather than a plain text editor with color-coding. It suits people new to Go as much as experienced Go developers who want gopls-backed completion and Delve debugging without switching to a dedicated Go IDE. It's a poor fit if you don't use VS Code at all, since the status bar, Command Palette commands, and settings it adds are specific to that editor.
How to Install and Get Started
Install Go 1.21 or newer first, then install the Go for VS Code extension (published as golang.go) from the Visual Studio Code Marketplace. Opening any .go file or a go.mod file activates it automatically โ there's no separate 'enable' step. A status-bar entry in VS Code's bottom-right corner names your active Go version, and a lightning-bolt icon next to it means gopls is running. Under the hood, it relies on `go`, `gopls`, plus a handful of optional tools; if `gopls` isn't installed yet, the extension offers to install it for you. Want early access to fixes before they reach stable? The pre-release channel uses odd minor-version numbers (0.ODD.patch) against even numbers (0.EVEN.patch) for stable, and you switch to it from the extension's dropdown on VS Code's extension management page.
Core Features for Go Development
- โCode completion driven by gopls, shown inline as you type rather than relying on static syntax matching.
- โSymbol navigation that jumps straight to, or previews, where something is declared without leaving the current file.
- โEditing conveniences: saved snippets, formatting on save, and Go imports reorganized for you automatically.
- โInline diagnostics from `go build`, `go vet`, and lint checks, flagged as you type or when you save.
- โA test runner wired directly into VS Code's own testing UI.
- โDelve-backed debugging with breakpoints, stepping, and variable inspection inside the editor.
- โA full command set reachable from the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`), from formatting to installing tools.
- โA status-bar entry naming your active Go version, with a lightning-bolt icon once gopls is confirmed active.
Configuring Your Go Workspace
The extension works in both classic GOPATH mode and Go modules mode, and current development is better served by modules, which have been the default build mode since Go 1.16. A module is just a directory tree with a go.mod file at its root, and unlike GOPATH mode it doesn't need to sit in any particular location on disk. If your workspace spans multiple modules or an uncommon layout, add each module root as a separate Workspace Folder so gopls can see them individually. For sharper color-coding than VS Code's built-in TextMate grammar gives you, turn on gopls' semantic highlighting by setting `"gopls": { "ui.semanticTokens": true }` in your settings. Most day-to-day actions, including running `Go: Install/Update Tools`, are reachable from the Command Palette rather than a menu.
Strengths
- โMaintained directly by engineers on Go's own tools team rather than a third-party plugin author.
- โMissing tools get installed for you: if `gopls` isn't present, the extension offers to install it instead of leaving you to run `go install` yourself.
- โCompletion, navigation, diagnostics, testing, and debugging are unified in one extension instead of several separate plugins.
- โGo Telemetry uploads are opt-in, not opt-out โ nothing goes to telemetry.go.dev unless you explicitly turn it on.
- โWorks with both GOPATH and Go modules, so older codebases aren't locked out of tooling that modules-based projects get.
Version Support and Known Considerations
- โณSupport only covers the current stable release and its matching pre-release build; once a new version ships, older installs are on their own.
- โณOfficial Go-version support tops out at the two newest major releases, with best-effort coverage reaching back across the three before that โ an older pinned Go toolchain needs the separate Compatibility page and manual tool versions.
- โณgopls and dlv are verified only against their own newest releases, so an older gopls paired with a new extension build isn't a combination the team tests.
- โณDefault Go syntax coloring comes from a TextMate rule built into VS Code itself, not from this extension โ sharper semantic highlighting has to be turned on by hand via a gopls setting.
- โณBeyond the Quick Start steps, the extension's own documentation for day-to-day usage lives in a separate wiki rather than the README, so some settings and workflows aren't covered here.
Other Go Development Environments
Frequently Asked Questions
The Go for VS Code extension needs VS Code 1.90 or newer, or any editor whose APIs match VS Code 1.90 and above, plus Go 1.21 or newer, per the README's Requirements section.
The Go for VS Code extension supports both Go modules and the older GOPATH mode, and the README recommends developing in module mode for current projects.
By default, the Go for VS Code extension keeps Go Telemetry uploads turned off; you opt in by running the gotelemetry CLI's `on` command, after which gopls sends performance and stability data to telemetry.go.dev.
Following the Go Release Policy, official support from the Go for VS Code extension covers the newest two major Go releases, and the Go team extends best-effort support across the three most recent major versions.
`gopls` is the official Go language server. The Go for VS Code extension hands completion, navigation, diagnostics, and formatting off to `gopls` instead of implementing that analysis itself, installing it automatically if it's missing.
The Go for VS Code extension is released under the MIT license, per the LICENSE file linked from its README.
The problem it solves
Go's own toolchain ships as separate command-line programs โ gofmt, go vet, go build, go test, dlv โ so without an integration layer, a Go developer working in a general-purpose text editor has to run each one by hand and cross-reference file:line output manually. The Go for VS Code extension's specific fix is wiring gopls and dlv into VS Code's own diagnostics, completion, and debug-adapter APIs, so build/vet/lint errors, symbol lookups, and breakpoints show up inline instead of living in a separate terminal pane.
Best use cases
- โขDebugging a Go service with breakpoints and variable inspection through VS Code's debug UI instead of driving Delve from a separate terminal.
- โขWorking across several Go modules in one workspace by adding each module root as a Workspace Folder.
- โขCatching build, vet, and lint errors inline while typing, instead of switching to a terminal to run `go vet` by hand.
- โขTrying pre-release fixes and features ahead of stable by switching to the odd-minor-version pre-release channel.
- โขKeeping gopls, `dlv`, and other supporting tools current by running `Go: Install/Update Tools` instead of managing them manually.
Related repositories
Curious whether vscode-go is right for you?
Let ChatGPT, Claude, or Perplexity look into it โ click below and see what AI actually says about vscode-go.
