Popular Editor Integrations
How to set up Visual Studio Code, GoLand, Vim/Neovim, and Emacs for Go development, with installation steps, essential extensions, and configuration tips.
Go code compiles from any plain-text editor, but a well‑configured environment turns the compiler and toolchain into an active partner while you type. Immediate feedback on errors, one‑key navigation to definitions, automatic formatting on save, and integrated debugging change how quickly you learn the language and how confidently you work with real codebases.
Four environments dominate the Go developer surveys year after year: Visual Studio Code, GoLand, Vim/Neovim, and Emacs. Each takes a different approach to the same problem — giving you the full power of the Go toolchain without leaving the editing surface. This page walks through installing and tuning each one so that you can choose the setup that fits the way you already work.
Visual Studio Code
VS Code’s Go extension is maintained by the Go team at Google together with Microsoft, and it uses the same gopls language server that powers most modern Go editing. If you do not have a strong preference for another editor, this is the integration that gets you from zero to productive with the fewest moving parts.
Installing the Go extension
The extension is called “Go” and its publisher is “Go Team at Google”. You install it once, then open any .go file to trigger the rest of the tool installation automatically.
Install VS Code
Download and install Visual Studio Code from code.visualstudio.com. VS Code runs on Windows, macOS, and Linux.
Install the Go extension
Open the Extensions view (Ctrl+Shift+X / Cmd+Shift+X), search for “Go”, and install the extension published by “Go Team at Google”.
Extension identifier:
The extension ID is golang.go. Install only this one; older forks like lukehoban.Go are no longer maintained.
Open a .go file and install Go tools
Create a file named main.go, or open any existing .go file in the editor. VS Code will show a notification asking you to install the required Go tools. Click “Install All”.
These tools include gopls (the language server), dlv (the Delve debugger), and staticcheck or golangci-lint for linting. They are installed into your GOBIN directory (or ~/go/bin by default).
Verify the setup
In your main.go file, start typing package main and notice that the editor offers completions immediately. Hover over any identifier — if gopls is running, you will see type information and documentation.
Everything is working:
If you see import suggestions, function signatures on hover, and red squiggles under real errors, the Go extension is set up correctly. No further configuration is required.
What the Go extension gives you
The extension delegates to gopls for most intelligence. Once connected, you get:
- Autocompletion as you type, including unimported packages (the editor adds the
importstatement when you accept a suggestion). - Diagnostics — compile errors and
vetwarnings appear instantly, not just when you save. - Code navigation — jump to definition, find references, and browse workspace symbols without leaving the keyboard.
- Formatting on save — by default the extension runs
gofmtorgoimportsevery time you save. No manual step; your code is always canonically formatted. - Refactoring — rename a symbol and all references update across the module.
- Integrated testing — run individual tests or entire packages from the editor, with results in the Test Explorer.
- Debugging — the Delve debugger integration lets you set breakpoints, inspect variables, and step through code right inside VS Code.
Debugging with Delve
When you open a main.go file with a main function, the Run and Debug view (Ctrl+Shift+D) shows a “launch” button. The extension generates a launch.json for you if one does not exist. Delve attaches to your process, and you can step, inspect, and set conditional breakpoints just as you would in a full IDE.
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
}
Most of the time you do not need to edit this file — the default "mode": "auto" picks the right debugging target based on the active file.
Missing Delve binary:
If debugging fails with “could not launch process: exec: “dlv””, Delve is not installed. Run go install github.com/go-delve/delve/cmd/dlv@latest and make sure $GOBIN (or ~/go/bin) is in your PATH.
Common pitfalls with VS Code
- gopls not found. If you see an error that
goplsis missing even after installing the tools, check that$GOBINis in your system’sPATH. VS Code starts the language server from the shell it inherits, so the binary must be discoverable. - “No packages found” in a module. Make sure you opened the folder that contains
go.mod, not a parent or a subdirectory. The language server needs the module root to index packages correctly. - Old
GOPATHhabits. IfGO111MODULEis explicitly set tooffin your environment, modern tooling may break. Unset it, or set it toon, and let Go auto‑detect the module context.
GoLand (JetBrains)
GoLand is a commercial, purpose‑built Go IDE from JetBrains. Unlike VS Code, which assembles its Go support from the extension and language server, GoLand has Go‑specific smarts baked into its own analysis engine. It understands the language without an external gopls process and exposes refactorings, inspections, and test runners that are tightly integrated with its GUI.
Installation and first project
Download GoLand from jetbrains.com/go and install it. When you launch it for the first time, you point it at a Go SDK — usually your system’s go installation — and optionally provide a GOPATH and module proxy settings.
Open or create a Go project
From the welcome screen, click “Open” and select a directory that contains a go.mod file. If you do not have one, choose “New Project” and GoLand will scaffold a module for you.
Configure the Go SDK
Go to File → Settings → Go → GOROOT and make sure the path points to your Go installation (e.g., /usr/local/go on Linux). GoLand detects the SDK automatically in most cases, but verify that the version shown matches the output of go version.
Enable Go modules integration
In Settings → Go → Go Modules, ensure “Enable Go modules integration” is checked. GoLand will index your dependencies and offer completion for packages in go.sum.
Run a file to verify
Open a main.go with a func main(). Click the green triangle in the gutter next to the function — the program should compile and run in the built‑in terminal.
Setup confirmed:
If the green run icon appears and the program runs without errors, GoLand is correctly connected to your Go SDK and your project is recognized as a Go module.
What sets GoLand apart
Because GoLand owns the entire analysis pipeline, it can detect problems that a standard language server might miss — unused parameters, expressions that always evaluate to the same value, or functions that could be simplified. Some features you will notice early on:
- On‑the‑fly inspections — hundreds of checks run in real time, with quick‑fix suggestions. Example: it catches a nil dereference path and offers to add a guard clause.
- Advanced refactorings — extract interface, change signature, inline variable, and more, with full module‑wide safety analysis.
- Integrated test runner — table‑driven tests appear as a tree, and you can run a single table entry without leaving the IDE.
- Database tools — if your Go service talks to a database, GoLand includes a full SQL client, schema visualizer, and code completion for SQL inside Go strings.
- VCS and Docker integration — Git history, branch management, and Docker Compose targets are all accessible from the same window.
GoLand is a paid product, but JetBrains offers free licenses for students, teachers, open‑source maintainers, and user groups. The pricing page at jetbrains.com/go/buy has current details.
Common pitfalls with GoLand
- GOROOT pointing at the wrong SDK. If GoLand indexes an older Go version than the one you intend to use, you may see “undefined” errors for modern features (like generics). Verify the GOROOT and check the project‑level SDK in File → Project Structure.
- Indexing very large monorepos. GoLand is heavier than a text editor. On projects with tens of thousands of files, you may need to exclude generated directories or
vendorfolders under Settings → Go → Vendoring & Build Tags to keep performance acceptable. - Modules vs. GOPATH confusion. If you open a directory without a
go.modbut have aGOPATHconfigured, GoLand may try to interpret it as a GOPATH project. Always prefer a module‑based project (withgo.mod) for new work.
Vim and Neovim
Vim users typically take one of two routes: the all‑in‑one vim-go plugin, or a lighter LSP‑based configuration that talks to gopls directly. Both approaches give you autocompletion, jump‑to‑definition, formatting, and debugging through Delve, but they differ in how they are assembled and maintained.
Option 1: vim-go (integrated toolkit)
vim-go is a mature plugin that bundles syntax highlighting, gofmt on save, :GoBuild, :GoTest, and many other commands. It does not require gopls by default; instead it shells out to the standard Go tools.
To install with vim-plug, add this to your init.vim or .vimrc:
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go'
call plug#end()
After restarting Vim, run :PlugInstall, then :GoInstallBinaries. The latter downloads the Go tools that vim-go relies on (guru, gopls, staticcheck, etc.) into your $GOBIN.
Running GoInstallBinaries:
:GoInstallBinaries installs every tool that vim-go can use. If you only want gopls and dlv, install those manually with go install and skip this step.
Option 2: LSP with gopls (via nvim-lspconfig)
If you prefer a setup that uses the standard LSP protocol (like your VS Code colleagues do), the combination of neovim/nvim-lspconfig and gopls is the modern path. This approach works with Neovim (≥ 0.8) and, with some effort, Vim 8+ using coc.nvim.
First, install gopls:
go install golang.org/x/tools/gopls@latest
Then in your Neovim configuration, enable the server:
local lspconfig = require('lspconfig')
lspconfig.gopls.setup{
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
}
Add a few convenience keymaps for the most common LSP actions:
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
end,
})
With this configuration, opening a .go file starts gopls in the background, and you get diagnostics, completions, and hover information as you work.
gopls binary not found:
If Neovim reports client gopls: exit status 1, the server binary is not in your PATH. Either add $GOBIN (commonly ~/go/bin) to your PATH, or set cmd = in the lspconfig setup.
Formatting and imports
Regardless of which plugin path you choose, you will want goimports to run on save. In vim-go, set:
let g:go_fmt_command = "goimports"
With LSP, gopls can format and organize imports on save automatically if you enable it in the Neovim LSP settings:
lspconfig.gopls.setup{
on_attach = function(client, bufnr)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end,
}
Common pitfalls with Vim/Neovim
- Conflicting plugins. Running
vim-goand an LSP client simultaneously can cause duplicate hover windows or unexpected behavior. Choose one primary completion/diagnostics source per buffer. - Slow
goplsstartup on large workspaces. If you open a directory with many modules,goplsmay take time to index. Exclude unnecessary folders with agoplsconfiguration setting:"directoryFilters": ["-node_modules", "-vendor"]. - Missing Delve integration. Even with
vim-goornvim-dap, you need thedlvbinary in your PATH for debugging. Install it viago install github.com/go-delve/delve/cmd/dlv@latest.
Confirming the LSP connection:
In Neovim, run :LspInfo. If you see “gopls” attached to your buffer, the language server is running. Hover over any identifier with K to see its documentation.
Emacs
Emacs talks to Go through go-mode for syntax highlighting and indentation, and through either lsp-mode or eglot for language server intelligence. The combination gives you an environment that is keyboard‑driven, highly customizable, and consistent with how Emacs handles other languages.
Installing go-mode and language server support
A typical use-package configuration brings everything together. This example uses eglot for LSP because it ships with Emacs 29 and requires no extra packages:
(use-package go-mode
:ensure t
:config
(add-hook 'go-mode-hook 'eglot-ensure)
(add-hook 'before-save-hook 'gofmt-before-save))
If you prefer the richer feature set of lsp-mode, install it from MELPA and use lsp instead:
(use-package go-mode
:ensure t
:hook (go-mode . lsp-deferred))
After restarting Emacs and opening a .go file, the language server starts automatically — assuming gopls is installed and in your exec-path.
gopls must be in exec-path:
Emacs does not inherit your shell PATH in the same way a terminal editor does. If you installed gopls to ~/go/bin, add (add-to-list 'exec-path "~/go/bin") to your init file. Otherwise, the language server will fail to start without an obvious error.
What your Emacs setup can do
Once gopls connects, you get:
- Autocompletion via
company-mode(witheglot) orlsp-mode’s built‑in completion. - On‑the‑fly diagnostics — errors and warnings appear as underlines and are browseable with
flymakeorflycheck. - Code navigation —
M-.jumps to definition,M-,pops back. This works across packages, even into the standard library if you have the Go source installed. - Formatting — the
gofmt-before-savehook ensures every save produces canonical formatting. - Test execution — with
go-mode, you can run the current test function withC-c C-tor the entire file’s tests withC-c C-f.
Many Emacs users add project‑wide search with rg or ag and an interactive Git interface like magit, which together create a full development workflow without leaving the editor.
Debugging in Emacs
Debugging is possible through dap-mode and Delve. The setup is more involved than in VS Code or GoLand, but for Emacs power users it integrates naturally:
(use-package dap-mode
:ensure t
:config
(dap-mode 1)
(dap-ui-mode 1)
(require 'dap-go))
After installing dlv, you can place breakpoints with dap-breakpoint-toggle and launch a debug session through the dap-debug interface.
Not required for learning:
If you are new to Emacs, focus on the editing and navigation flow first. Debugging can be added later once you are comfortable with the basic environment.
Common pitfalls with Emacs
- lsp-mode not finding gopls. Check
exec-pathand, if usinglsp-mode, verify that thelsp-gopackage is installed so that the proper server registration is triggered. - Multiple LSP clients. If both
eglotandlsp-modeare active on the same buffer, they will fight over the connection. Enable one or the other, not both. - go-mode without project awareness. By itself,
go-modeis a simple major mode. You needgoplsto get import management and package‑aware completion. Ifeglotorlspare not starting, the session degrades to a syntax‑highlighted text editor.
Verifying LSP in Emacs:
With eglot, run M-x eglot-events-buffer to see the JSON‑RPC traffic. If you see textDocument/publishDiagnostics messages, the server is communicating correctly.
Other editors worth knowing about
The four integrations above cover the vast majority of Go developers, but several other editors have active Go communities and are worth a brief mention:
- Sublime Text — The
LSPandLSP-goplspackages (Sublime Text 4 only) provide IDE‑like features. Older setups usedGoSublime, but that plugin is no longer actively maintained. If you use Sublime, prefer the LSP route. - LiteIDE — A lightweight, cross‑platform IDE purpose‑built for Go. It has a built‑in debugger and project management, and it does not require any plugin setup. Development is community‑driven and stable, though module support sometimes lags behind newer Go features.
- Atom (community forks) — The original Atom editor is discontinued. If you use a maintained fork, the
go-pluspackage used to offer full Go support. Be aware that module‑aware tooling may have gaps. - BBEdit, TextMate, Nova (macOS) — These native Mac editors all have Go syntax bundles and, in the case of Nova, LSP support through
gopls.
These editors can be perfectly productive, but their Go support often depends on a single maintainer or a small community. If you are starting fresh, the main four editors in this page are safer, better‑documented choices.
Choosing an integration
There is no universally best editor, but the decision becomes straightforward when you map your priorities:
| If you want… | Choose… |
|---|---|
| A free, fast setup with official support and remote‑container development | Visual Studio Code + Go extension |
| A full IDE with deep code analysis, advanced refactoring, and database tools — and you are willing to pay | GoLand |
| A keyboard‑driven, modal editor that runs in the terminal and stays out of your way | Vim/Neovim with vim-go or LSP + gopls |
| A fully extensible Lisp‑based environment that treats Go as one language among many | Emacs with go-mode and eglot/lsp-mode |
Whichever editor you pick, the most important piece is the Go language server. gopls is the engine behind code intelligence in VS Code, the LSP path in Vim/Neovim, and the LSP backends in Emacs and Sublime. Even GoLand, which does not use gopls, taps into the same set of Go tools — gofmt, go vet, dlv — that every integration ultimately depends on. Setting up these tools correctly matters more than the editor that sits on top of them.