Integration with Go tools
Format Go code with gofmt
With gofmt, you can format Go source code in the opened file or in the whole Go project.
To format code in the opened file, go to.
To format code in the current project, go to.
Add import lines automatically with goimports
If your project does not have goimports, click the go get goimports link in the Goimports file notification window. Otherwise, open the Terminal tool window ( ), and type the following command to install goimports:
go get golang.org/x/tools/cmd/goimports. Press Enter.
To add missing imports, navigate to Goimports file.and click
Create or update Go source files with go generate
Add the following line to your Go code:
//go:generate command arguments(for example,
//go:generate stringer -type=Pill)
Inspect Go code with go vet
To find possible bugs or suspicious constructs with
go vet, click . You can see the result of code analysis in the Terminal tool window.