Visual Studio
The VS Code Go extensionprovides rich language support for theGo programming language.
📣 Gopls, the official Go language server, is now enabled in VS Code by default.Gopls replaces several legacy tools to provide IDE features while editing Go code.See issue 1037 for more information.
- These downloads may update Visual Studio and the.NET Framework on your machine. Some of the downloads may only support certain Visual Studio versions.NET Core.NET Core is a free, cross-platform, open-source developer platform for building many different types of applications.
- Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.
- Visual Studio Codespaces is moving toGitHub and this portal will be retired on February 17, 2021. New user sign-ups have been disabled.Learn more.
Quick Start
Welcome! 👋🏻
Whether you are new to Go or an experienced Go developer, we hope thisextension fits your needs and enhances your development experience.
- Step 1. If you haven't done so already, install Goand the VS Code Go extension.
- Go installation guide. This extension works best with Go 1.14+.
- Managing extensions in VS Code.
- Step 2. To activate the extension, open any directory or workspacecontaining Go code. Once activated, the Go status bar willappear in the bottom left corner of the window and show the recognized Goversion.
- Step 3. The extension depends on a set of extra command-line tools.If they are missing, the extension will show the '⚠️ Analysis Tools Missing'warning. Click the notification to complete the installation.
(Install Missing Tools)
Download Visual Studio Code for Windows now from Softonic: 100% safe and virus free. More than 4967 downloads this month. Download Visual Studio Code latest version 2021.
You are ready to Go :-) 🎉🎉🎉
Please be sure to learn more about the many features of thisextension, as well as how to customize them. Take a look atTroubleshooting and Help for furtherguidance.
If you are new to Go, this article providesthe overview on Go code organization and basic go
commands. Watch this videofrom the Go Open Source Live conference for an explanation of how to buildyour first Go application using VS Code Go.
Visual Studio 2019 Comparison
Features
This extension provides many features, including IntelliSense,code navigation, and code editing support. It also shows diagnostics asyou work and provides enhanced support for testing and debugging yourprograms. See the full feature breakdown for more details and to learn how totune its behavior.
(Code completion and Signature Help)
In addition to integrated editing features, the extension provides severalcommands for working with Go files. You can access any of these by opening theCommand Palette (Ctrl+Shift+P
on Linux/Windows and Cmd+Shift+P
on Mac), andthen typing in the command name. See thefull list of commands provided by thisextension.
(Toggle Test File)
⚠️ Note: the default syntax highlighting for Go files is provided by aTextMate rule embedded in VSCode, not by this extension.
Tools
The extension uses a few command-line tools developed by the Go community. Inparticular, go
, gopls
, and dlv
must be installed for this extensionto work correctly. See the tools documentation for a completelist of tools the extension depends on.
In order to locate these command-line tools, the extension searchesGOPATH/bin
and directories specified in the PATH
environment variable (orPath
on Windows) with which the VS Code process has started. If the tools arenot found, the extension will prompt you to install the missing tools and showthe '⚠️ Analysis Tools Missing' warning in the bottom right corner. Pleaseinstall them by responding to the warning notification, or by manually runningthe Go: Install/Update Tools
command.
Setting up your workspace
Go modules are how Go manages dependencies inrecent versions of Go. Modules replace the GOPATH
-based approach to specifyingwhich source files are used in a given build, and they are the default buildmode in go1.16+. While this extension continues to support both Go modules andGOPATH
modes, we highly recommend Go development in module mode. If you areworking on existing projects, please consider migrating to modules.
Unlike the traditional GOPATH
mode, module mode does not require the workspaceto be located under GOPATH
nor to use a specific structure. A module isdefined by a directory tree of Go source files with a go.mod
file in thetree's root directory.
Your project may involve one or more modules. If you are working with multiplemodules or uncommon project layouts, you will need to configure your workspaceby using Workspace Folders. Please see this documentation about supportedworkspace layouts.
Customization
Visual Studio 2017
The extension needs no configuration and should work out of the box. However,you may wish to adjust settings to customize its behavior. Please see thesettings documentation for a comprehensive list of settings.See advanced topics for further customizations and uniqueuse cases.
Visual Studio Community
Troubleshooting
If the extension isn't working as you expect, you can take a look at ourtroubleshooting guides. There is one for generaltroubleshooting, and another specifically fortroubleshooting the debugging feature.
Ask for help
If the troubleshooting guides did not resolve the issue, please reach out to usby filing an issue,starting a GitHub discussion,or by asking a question in the Gophers Slack. We hang out in the #vscode
channel!
Also, you can take a look at learn.go.dev andgolang.org/help for more general guidance on usingGo.
Preview version
If you'd like to get early access to new features and bug fixes, you can use thenightly build of this extension. Learn how to install it in by reading theGo Nightly documentation.
Contributing
We welcome your contributions and thank you for working to improve the Godevelopment experience in VS Code. If you would like to help work on the VS CodeGo extension, please see our contribution guide. Itexplains how to build and run the extension locally, and describes the processof sending a contribution.
Code of Conduct
This project follows theGo Community Code of Conduct. If you encounter aconduct-related issue, please mail conduct@golang.org.