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:
Feature Contributions tab.Commands.Finally, you can also see a full list by using a meta command: Go: Show All Commands....
Go: Current GOPATHSee the currently set GOPATH.
Go: Locate Configured Go ToolsList all the Go tools being used by this extension along with their locations.
Go: Test Function At CursorRuns a unit test at the cursor.
Go: Subtest At CursorRuns a sub test at the cursor.
Go: Benchmark Function At CursorRuns a benchmark at the cursor.
Go: Debug Test At CursorDebug test at the cursor.
Go: Test FileRuns all unit tests in the current file.
Go: Test PackageRuns all unit tests in the package of the current file.
Go: Benchmark PackageRuns all benchmarks in the package of the current file.
Go: Benchmark FileRuns all benchmarks in the current file.
Go: Test All Packages In WorkspaceRuns all unit tests from all packages in the current workspace.
Go: Test PreviousRe-runs the last executed test.
Go: Toggle Test Coverage In Current PackageDisplays test coverage in the current package.
Go: Generate Unit Tests For PackageGenerates unit tests for the current package
Go: Generate Unit Tests For FileGenerates unit tests for the current file
Go: Generate Unit Tests For FunctionGenerates unit tests for the selected function in the current file
Go: Generate Interface StubsGenerates method stub for implementing the provided interface and inserts at the cursor.
Go: Add ImportAdd an import declaration
Go: Add Package to WorkspaceAdd a package from the imports list to the workspace.
Go: Install/Update Toolsinstall/update the required go packages
Go: Toggle Test FileToggles between file in current active editor and the corresponding test file.
Go: Add Tags To Struct FieldsAdd tags configured in go.addTags setting to selected struct using gomodifytags
Go: Remove Tags From Struct FieldsRemove tags configured in go.removeTags setting from selected struct using gomodifytags
Go: Fill structFill a struct literal with default values
Go: Show All Commands...Shows all commands from the Go extension in the quick pick
Go: Browse PackagesBrowse packages and Go files inside the packages.
Go: Get PackageRun go get -v on the package on the current line.
Go: Run on Go PlaygroundUpload the current selection or file to the Go Playground
Go: Lint Current PackageRun linter in the package of the current file.
Go: Lint WorkspaceRun linter in the current workspace.
Go: Vet Current PackageRun go vet in the package of the current file.
Go: Vet WorkspaceRun go vet in the current workspace.
Go: Build Current PackageBuild the package of the current file.
Go: Build WorkspaceBuild the current workspace.
Go: Install Current PackageInstall the current package.
Go: Cancel Running TestsCancels running tests.
Go: Apply Cover ProfileApplies existing cover profile.
Go: Extract to functionExtract to function using godoctor.
Go: Extract to variableExtract to variable using godoctor.
Go: Restart Language ServerRestart the running instance of the language server
Go: Choose Go EnvironmentChoose a different Go version or binary for this project. (WIP)