Go Workspace Library Navigator
Browse the Go SDK, workspace modules, and dependencies in the VS Code Explorer. Each go.work has its own group, so projects in the same folder can use different versions or local copies of the same module.
Features
- Multiple projects and workspaces: discover nested
go.mod and go.work files, including workspaces with a single use and modules outside the opened folder.
- Local
use and replace: browse the source directory selected for each workspace; remote version replacements are shown with their original and replacement identities.
- Go SDK and source tree: expand the standard library and module directories on demand, and open source files in the editor.
- Navigation: search module names or filenames, and reveal the active source file without moving keyboard focus. Shared libraries prefer the most recently used project.
- Refresh and missing dependencies: watch configuration files and expanded directories for changes when filesystem notifications are available. Missing modules remain visible and can be downloaded on request.
- Works with your Go setup: use the configured Go executable and
go.toolsEnvVars. The official Go extension is optional for browsing.
An example of the view:
External Libraries
├─ Go SDK 1.27.3
├─ Go Workspace <catalog/go.work>
│ ├─ Go Module <example.com/catalog>
│ ├─ Go Module <example.com/shared>
│ └─ example.com/metrics v1.0.0 => local source
└─ Go Workspace <billing/go.work>
├─ Go Module <example.com/billing>
└─ Go Module <example.com/billing-core>
Module names in this example are fictional. The included media/overview.png is an illustrated overview, not a screenshot.
Requirements and installation
Use VS Code 1.90 or newer, a trusted workspace, and an available Go toolchain. Go workspaces require Go 1.18 or newer; the toolchain must also support the Go version used by the project. Install Go Workspace Library Navigator from the Extensions view, then open a folder containing Go projects. The External Libraries view appears in the Explorer.
In WSL, SSH, or a Dev Container, install the extension in the remote extension host and make Go available there. The extension uses that host's filesystem and Go environment.
For a locally built VSIX, the existing commands still work from the source directory:
npm ci
npm run package
code --install-extension "./artifacts/go-external-libraries-0.1.0.vsix"
Browsing and downloads
Use the view title actions to refresh, collapse, or find a module. Right-click a library or directory to find a filename, open its configuration, or copy its path. File search returns up to 200 matches; entering a more specific name narrows the results.
Some Dev Container mounts do not deliver filesystem change notifications. In a tested Windows folder mounted through 9p, changes to go.work and expanded library directories did not refresh automatically. Use Refresh in the view title to reload the tree when this occurs.
The background scan uses the local module cache and does not download dependencies. A missing source remains in the tree: choose Download Module for an unambiguous remote version or Download Dependencies for its group. A missing local replacement is reported as a local path; it is never replaced by a remote download.
Browsing and explicit downloads use temporary configuration copies. The original go.mod, go.work, and sum files are not rewritten by the extension. The Go module cache can change when a download is requested. Error details are available in Output → Go External Libraries.
Discovery ignores .gitignore for go.work files and does not recursively follow directory symlinks. Each discovered go.work is displayed as a separate context, including when the terminal has GOWORK=off; the view does not change the workspace chosen by your terminal or language server.
Settings
| Setting |
Default |
Description |
goExternalLibraries.autoReveal |
true |
Reveal active library files while the view is visible. |
goExternalLibraries.goPath |
empty |
Go executable; otherwise use the Go extension's public API and then PATH. |
goExternalLibraries.exclude |
Git, Mercurial, Subversion, node_modules, vendor |
Glob patterns excluded from project discovery and filename search. Built-in exclusions always apply. |
goPath supports workspace and folder settings. go.goroot and go.toolsEnvVars are also read for the corresponding resource. Paths support ${workspaceFolder}, ${env:NAME}, and a leading ~.
Commands are available under Go External Libraries in the Command Palette: Refresh, Collapse All, Reveal Active File, Find Module, Find File in Library, Open Go Configuration, Copy Path, Download Module, and Download Dependencies.
Scope and current validation
This release targets Go Modules. Full-text search, dependency upgrades, vendor source mapping, GOPATH projects, and browser-only virtual workspaces are outside its current scope. Vendor mode and unsupported GOFLAGS are reported without presenting module-cache sources as vendor sources. The extension is disabled in untrusted workspaces.
Windows, Linux containers, and WSL have passed core tests. The VS Code Extension Host and an installed VSIX have been tested on Windows. Remote VS Code testing covered WSL, SSH to a local WSL host, and a Linux Dev Container; automatic refresh passed on their Linux filesystems, subject to the mount limitation above. macOS has not been tested.
中文说明
Go Workspace Library Navigator 在 VS Code 资源管理器中展示 Go SDK、工作区模块和依赖。同一目录下的多个 go.work 分别成组,同名模块可以在不同组中指向不同版本或本地源码。
- 自动发现多项目、独立
go.mod,以及工作区外的 use 和本地 replace。
- 按需展开 SDK 与模块源码,支持模块搜索、库内文件名搜索和当前文件自动定位。
- 在文件系统提供变化通知时监听配置和已展开目录;源码缺失时保留节点,用户可以按需下载。
- 后台浏览使用本地缓存,不自动下载依赖;浏览和主动下载都使用临时配置副本,不改写原项目的 mod、work 和 sum 文件。
安装后打开包含 Go 项目的文件夹,在资源管理器中展开 External Libraries。需要可信工作区、VS Code 1.90+ 和可用的 Go 工具链;使用 go.work 需要 Go 1.18+。WSL、SSH 和 Dev Container 需要在远程扩展宿主安装扩展,并在该环境中配置 Go。
常用设置为 goExternalLibraries.autoReveal、goExternalLibraries.goPath 和 goExternalLibraries.exclude。在命令面板搜索 Go External Libraries 可以查看所有操作。
部分 Dev Container 挂载无法传递文件变化通知。在已测试的 Windows 目录 9p 挂载中,go.work 和已展开的库目录发生变化时不会自动刷新;遇到这种情况,请点击视图标题栏的 Refresh 手动刷新。
首版面向 Go Modules,暂不提供全文搜索、依赖升级、vendor 源码映射、GOPATH 模式或纯浏览器虚拟工作区。Windows、Linux 容器和 WSL 已完成核心测试;VS Code 远程测试覆盖了 WSL、连接到本机 WSL 的 SSH 和 Linux Dev Container,Linux 文件系统上的自动刷新通过。macOS 尚未实测。
Development
Node.js 22.22 or newer is recommended for the development and packaging tools.
npm ci
npm run check
npm test
npm run test:host
npm run package
npm run build creates the extension bundle. To try the fictional sample from a source checkout, open examples/demo/projects in a trusted VS Code window. npm run smoke:project checks a local project without rewriting its Go configuration; set GO_LIBRARIES_PROJECT to choose a project, or use the demo when no local configuration exists.
The project uses the MIT license. Third-party notices are included in the VSIX.