In addition to integrated editing features, this extension offers a number of commands, which can be executed manually through the Command Palette (Ctrl+Shift+P on Linux/Windows or Cmd+Shift+P on Mac OS).
Some of these commands are also available in the VS Code context menu (right-click). To control which of these commands show up in the editor context menu, update the "go.editorContextMenuCommands"
setting.
All commands provided by this extension have the prefix Go:
.
The commands described below are up-to-date as of June 2020. We do our best to keep documentation current, but if a command is missing, you can always consult the full list in the Extensions view.
To view this list:
- Navigate to the Extensions view (Ctrl+Shift+X).
- Find the Go extension and click on it to open the Extension Editor.
- Click on the
Feature Contributions
tab. - Scroll through the list under
Commands
.
Finally, you can also see a full list by using a meta command: Go: Show All Commands...
.
See the currently set GOPATH.
See the currently set GOROOT.
List all the Go tools being used by this extension along with their locations.
Runs a unit test at the cursor.
Runs a unit test at the cursor if one is found, otherwise re-runs the last executed test.
Runs a sub test at the cursor.
Debug a sub test at the cursor.
Runs a benchmark at the cursor.
Debug test at the cursor.
Runs all unit tests in the current file.
Runs all unit tests in the package of the current file.
Toggles hiding the system goroutines from the active debug session call stack view.
Refresh a test in the test explorer. Only available as a context menu option in the test explorer.
Show last captured profile
Run a test and capture a profile
Delete selected profile
Internal use. Open a pprof profile file.
Runs all benchmarks in the package of the current file.
Runs all benchmarks in the current file.
Runs all unit tests from all packages in the current workspace.
Re-runs the last executed test.
Re-runs the last debugged test run through a codelens or "Go: Debug Test at Cursor" command.
Displays test coverage in the current package.
Generates unit tests for the current package
Generates unit tests for the current file
Generates unit tests for the selected function in the current file
Generates method stub for implementing the provided interface and inserts at the cursor.
Extract logs in the gopls (server)
output channel to the editor.
Open the welcome page for the Go extension.
Toggle the display of compiler optimization choices
Add an import declaration
Add a package from the imports list to the workspace.
install/update the required go packages
Toggles between file in current active editor and the corresponding test file.
Toggle the display of vulnerability analysis in dependencies.
Start the Go language server's maintainer interface (a web server).
Add tags configured in go.addTags setting to selected struct using gomodifytags
Remove tags configured in go.removeTags setting from selected struct using gomodifytags
Shows all commands from the Go extension in the quick pick
Browse packages and Go files inside the packages.
Run go get -v
on the package on the current line.
Upload the current selection or file to the Go Playground
Run linter in the package of the current file.
Run linter in the current workspace.
Run go vet in the package of the current file.
Run go vet in the current workspace.
Build the package of the current file.
Build the current workspace.
Install the current package.
Run go mod init
in the workspace folder.
Cancels running tests.
Applies existing cover profile.
Restart the running instance of the language server
Choose a different Go version or binary for this project. (WIP)
Show the current Go survey configuration
Reset the current Go survey configuration history
Reset keys in workspace state to undefined.
Reset keys in global state to undefined.
Refresh the Go explorer. Only available as a menu item in the explorer.
Open a file from the Go explorer. Only available as a menu item in the explorer.
Edit the Go Env for the active workspace.
Reset the Go Env for the active workspace.