vscode-go

golang活跃维护

VS Code 的官方 Go 语言扩展,提供代码补全、调试、测试和格式化等完整开发支持,让 Go 开发者在编辑器里顺畅写代码。

Go extension for Visual Studio Code

v0.58.0发布于 2026-10-20 14:46 UTC4,271star937fork同步于 2026-11-10 17:39 UTC

怎么上手

由 README 提炼,执行前请确认
在 VS Code 扩展市场安装 golang.go;打开任意 Go 文件或 go.mod 自动激活,缺失 gopls 时扩展会尝试自动安装
硬件要求按 README 说明

README 未说明硬件要求;需 VS Code 1.125 或更新版本,以及 Go 1.21 或更新版本。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

VS Code 官方 Go 语言扩展,提供补全、跳转、诊断与调试等完整开发支持

VS Code 的官方 Go 语言扩展,提供代码补全、调试、测试和格式化等完整开发支持,让 Go 开发者在编辑器里顺畅写代码。

核心能力

  • 依赖 gopls 语言服务器提供 IntelliSense 与符号补全
  • 支持跳转或预览符号声明等代码导航
  • 保存时格式化、整理 import 并支持代码片段
  • 边输入或保存时展示 build、vet、lint 诊断
  • 内置测试与调试增强支持,可切换测试文件

容易踩的坑

扩展依赖 go、gopls 及可选工具,缺失时需通过 Go: Install/Update Tools 安装;Go 文件默认语法高亮由 VS Code 内置 TextMate 规则提供,需开启 gopls 的 ui.semanticTokens 才有更好高亮;Go Telemetry 默认关闭,需手动执行命令开启上传

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.58.0
  1. v0.59.0Release v0.59.0pre-release2026-10-20 · 2026-10-20 15:48 UTC
    查看更新说明

    This is the pre-release version of v0.60.0.

    Date: 2026-10-20

    Full Changelog: https://github.com/golang/vscode-go/compare/v0.58.0-rc.1...v0.59.0 Milestone: https://github.com/golang/vscode-go/issues?q=milestone%3Av0.60.0

    v0.59.0 is a pre-release version identical to the official release v0.58.0, incorporating all the same bug fixes and improvements. This may include additional, experimental features that are not yet ready for general release. These features are still under development and may be subject to change or removal.

    See release https://github.com/golang/vscode-go/releases/tag/v0.58.0 for details.

  2. v0.58.0Release v0.58.0最新正式版2026-10-20 · 2026-10-20 14:46 UTC

    Date: 2026-10-20

    Full Changelog: https://github.com/golang/vscode-go/compare/v0.56.1...v0.58.0 Milestone: https://github.com/golang/vscode-go/issues?q=milestone%3Av0.58.0

    • vscode-go now supports v3.18 of the Language Server Protocol.
    • Improved diagnostic deduplication across gopls, build, vet, and linters (#3511):
      • Deduplication now checks start position (line and column), and severity level.
      • Diagnostics on different columns of the same line can now coexist.
    • The "Go: Generate Interface Stubs" command (go.impl.cursor) is now powered by gopls by default using interactive refactoring. Place your cursor inside the target type declaration (e.g. type Foo struct), and gopls will prompt for the interface to implement and insert the method stubs after the type declaration. The previous implementation remains available via the "Go: Generate Interface Stubs (legacy)" command (go.impl.cursor.legacy), which inserts method stubs directly at the cursor location.
    • The "Go: Add Tags to Struct Fields" and "Go: Remove Tags From Struct Fields" commands now prompt for the tags via gopls unless tags or options are configured in go.addTags or go.removeTags. The default values of go.addTags (previously json tags with omitempty) have been removed, and go.removeTags no longer removes all tags by default. If promptForTags is true, the settings are ignored and gopls always prompts. (#4070)
    • Replaced the wmic-based Windows process picker for attach debugging with the native @vscode/win32-app-container-tokens module, as the wmic tool itself is deprecated on Windows (#3687).
    • Language client trace logging is now integrated with VS Code's LogOutputChannel log level system. To view verbose trace logs in the gopls output channel, in addition to setting "go.trace.server": "verbose", you must also set the gopls channel log level to Trace (using the Developer: Set Log Level... command or channel settings).
  3. v0.58.0-rc.1Release v0.58.0-rc.1pre-release2026-10-19 · 2026-10-19 15:34 UTC
    查看更新说明

    Date: 2026-10-19

    Full Changelog: https://github.com/golang/vscode-go/compare/v0.56.1...v0.58.0-rc.1 Milestone: https://github.com/golang/vscode-go/issues?q=milestone%3Av0.58.0

    • How to test release candidate:
      • Download the .vsix file from this Releases page.
      • Navigate to the Extensions view in VS Code (Ctrl+Shift+X). Click on the "..." in the top-right corner, select "Install from VSIX", and select the .vsix file you downloaded. Alternatively, you can run code --install-extension Go-latest.vsix or open the Command Palette and run the "Extensions: Install from VSIX..." command.
      • If prompted, reload VS Code.
  4. v0.56.1Release v0.56.12026-08-27 · 2026-08-27 15:18 UTC
    查看更新说明
  5. v0.56.1-rc.1Release v0.56.1-rc.1pre-release2026-08-26 · 2026-08-26 14:36 UTC
    查看更新说明

    Date: 2026-08-26

    Full Changelog: https://github.com/golang/vscode-go/compare/v0.56.0...v0.56.1-rc.1 Milestone: https://github.com/golang/vscode-go/issues?q=milestone%3Av0.56.1

    • How to test release candidate:
      • Download the .vsix file from this Releases page.
      • Navigate to the Extensions view in VS Code (Ctrl+Shift+X). Click on the "..." in the top-right corner, select "Install from VSIX", and select the .vsix file you downloaded. Alternatively, you can run code --install-extension Go-latest.vsix or open the Command Palette and run the "Extensions: Install from VSIX..." command.
      • If prompted, reload VS Code.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Go for Visual Studio Code

    Slack

    The VS Code Go extension provides rich language support for the Go programming language.

    Requirements

    • Visual Studio Code 1.125 or newer (or editors compatible with VS Code 1.125+ APIs)
    • Go 1.21 or newer.

    Quick Start

    Welcome! 👋🏻 Whether you are new to Go or an experienced Go developer, we hope this extension fits your needs and enhances your development experience.

    1. Install Go 1.21 or newer if you haven't already.

    2. Install the VS Code Go extension.

    3. Open any Go file or go.mod file to automatically activate the extension. The Go status bar appears in the bottom right corner of the window and displays your Go version.

    4. The extension depends on go, gopls (the Go language server), and optional tools depending on your settings. If gopls is missing, the extension will try to install it. The :zap: sign next to the Go version indicates the language server is running, and you are ready to go.

    You are ready to Go :-)    🎉🎉🎉

    What's next

    If you are new to Go, this article provides the overview on Go code organization and basic go commands. Watch "Getting started with VS Code Go" for an explanation of how to build your first Go application using VS Code Go.

    Feature highlights

    • IntelliSense - Results appear for symbols as you type.
    • Code navigation - Jump to or peek at a symbol's declaration.
    • Code editing - Support for saved snippets, formatting and code organization, and automatic organization of imports.
    • Diagnostics - Build, vet, and lint errors shown as you type or on save.
    • Enhanced support for testing and debugging

    See the full feature breakdown for more details.

    In addition to integrated editing features, the extension provides several commands for working with Go files. You can access any of these by opening the Command Palette (Ctrl+Shift+P on Linux/Windows and Cmd+Shift+P on Mac), and then typing in the command name. See the full list of commands provided by this extension.

    ⚠️ Note: the default syntax highlighting for Go files is provided by a TextMate rule embedded in VS Code, not by this extension.

    For better syntax highlighting, we recommend enabling semantic highlighting by turning on Gopls' ui.semanticTokens setting. "gopls": { "ui.semanticTokens": true }

    Setting up your workspace

    The VS Code Go extension supports both GOPATH and Go modules modes.

    Go modules are used to manage dependencies in recent versions of Go. Modules replace the GOPATH-based approach to specifying which source files are used in a given build, and they are the default build mode in go1.16+. We highly recommend Go development in module mode. If you are working on existing projects, please consider migrating to modules.

    Unlike the traditional GOPATH mode, module mode does not require the workspace to be located under GOPATH nor to use a specific structure. A module is defined by a directory tree of Go source files with a go.mod file in the tree's root directory.

    Your project may involve one or more modules. If you are working with multiple modules or uncommon project layouts, you will need to configure your workspace by using Workspace Folders. See the Supported workspace layouts documentation for more information.

    Pre-release version

    If you'd like to get early access to new features and bug fixes, you can use the pre-release extension. Following the vscode's convention, we use the minor version of the extension version number to distinguish stable and pre-release versions (0.ODD_NUMBER.patch for pre-release, 0.EVEN_NUMBER.patch for stable release).

    To install the pre-release version, use the drop-down list to select "Install Pre-Release Version", or if already installed the Go extension, use the "Switch to Pre-Release Version" option in the Visual Studio Code extension management page. For more details about this mechanism, see the Visual Studio Code's documentation.

    Telemetry

    VS Code Go extension relies on the Go Telemetry to learn insights about the performance and stability of the extension and the language server (gopls). Go Telemetry data uploading is disabled by default and can be enabled with the following command:

    go run golang.org/x/telemetry/cmd/gotelemetry@latest on
    

    After telemetry is enabled, the language server will upload metrics and stack traces to telemetry.go.dev. You can inspect what data is collected and can be uploaded by running:

    go run golang.org/x/telemetry/cmd/gotelemetry@latest view
    

    If we get enough adoption, this data can significantly advance the pace of the Go extension development, and help us meet a higher standard of reliability. For example:

    • Even with semi-automated crash reports in VS Code, we've seen several crashers go unreported for weeks or months.
    • Even with a suite of benchmarks, some performance regressions don't show up in our benchmark environment (such as the completion bug mentioned below!).
    • Even with lots of great ideas for how to improve gopls, we have limited resources. Telemetry can help us identify which new features are most important, and which existing features aren't being used or aren't working well.

    These are just a few ways that telemetry can improve gopls. The telemetry blog post series contains many more.

    Go telemetry is designed to be transparent and privacy-preserving. Learn more at https://go.dev/doc/telemetry.

    Support Policy

    The Go extension is maintained by engineers on the Go tools team, who actively monitor the VS Code Go and the Go issue trackers.

    We support only the latest stable and pre-release versions of the extension.

    Supported Go and tools

    The Go extension follows the Go Release Policy, meaning that it officially supports the two most recent major Go releases. The Go team maintains best-effort support for the last three major Go versions.

    The Go extension relies on tools like gopls and dlv for its core functionalities and they have their own release policy and schedule. We test only against the latest versions of these tools.

    In case you need to work with an older version of Go, please check the Compatibility page and manually install the compatible version of the extension and tools.

    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, see our contribution guide to learn how to build and run the VS Code Go extension locally and contribute to the project.

    Code of Conduct

    This project follows the Go Community Code of Conduct. If you encounter a conduct-related issue, please mail [email protected].

    License

    MIT