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).
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.
List all the Go tools being used by this extension along with their locations.
Runs a unit test at the cursor.
Runs 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.
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.
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.
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.
Add tags configured in go.addTags setting to selected struct using gomodifytags
Remove tags configured in go.removeTags setting from selected struct using gomodifytags
Fill a struct literal with default values
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.
Cancels running tests.
Applies existing cover profile.
Extract to function using godoctor.
Extract to variable using godoctor.
Restart the running instance of the language server