Skip to content

Latest commit

 

History

History
45 lines (22 loc) · 2.98 KB

ui.md

File metadata and controls

45 lines (22 loc) · 2.98 KB

Extension UI

Using The Go Status Bar

The Go status bar appears in the lower left of the extension window. Clicking the Go status bar brings up a menu that provides easy access to see and update important information about your Go project. This includes information about the Go environment, the current Go version, the gopls trace, and about the current module.

vscode extension after Go status bar item is clicked

Go Environment

The Go Locate Configured Go Tools command will display the configured GOPATH, GOROOT, tool locations and the results of go env in the output window.

Managing Your Go Version

You can view the current Go version by looking at the status bar item in the bottom left corner of VS Code. Clicking this button and selecting Choose Go Environment will present you with a menu from which you can select any version of Go that exists in your $HOME/sdk directory or on https://golang.org/dl. This command is also available through the command pallette using Go: Choose Go Environment.

Previously, the go.goroot and go.alternateTools settings controlled the Go version used by VS Code Go. If you have configured these settings, they are no longer needed and should be deleted.

command pallete menu for selecting a new Go version

The "Clear Selection" option resets your Go version to the one found first in either go.alternateTools, go.goroot or your PATH.

Installing a New Go Version

After selecting any Go version that has not yet been installed (such as Go 1.14.6 in the screenshot above), the binary will be automatically installed in $HOME/sdk and put to use in your environment.

Once the download completes, VS Code Go will make use of this new Go version.

Language Server Status

gopls is the official Go language server developed by the Go team. It was developed in response to the release of Go modules, and it is the recommended approach when working with Go modules in VS Code.

When gopls is enabled, ⚡ is displayed next to the Go version in the status bar and the gopls version is displayed in the menu.

command pallete menu for selecting a new Go version

Selecting Open 'gopls' trace will open the trace of the gopls server in the output window. Please include this trace when filing an issue related to the extension and gopls is enabled.

Modules Status

When modules are enabled for the file you have open, you can navigate to the go.mod file for the project using the menu. If you do not see the Open go.mod item, then the extension does not think the file you have open belongs to a module.

More information about using Go modules is available on the Go blog.