go-vet
Check Go source code and report suspicious constructs (e.g. lint your Go source files).
TLDR
Check the Go package in the current directory
$ go vet
Check the Go package in the specified path
$ go vet [path/to/file_or_directory]
List available checks that can be run with go vet
$ go tool vet help
View details and flags for a particular check
$ go tool vet help [check_name]
Display offending lines plus N lines of surrounding context
$ go vet -c=[N]
Output analysis and errors in JSON format
$ go vet -json
SYNOPSIS
go vet [ā-nā] [ā-xā] [ packages ]
DESCRIPTION
Vet runs the Go vet command on the packages named by the import paths.
For more about vet, see 'godoc vet'.
For more about specifying packages, see go-packages(7).
To run the vet tool with specific options, run 'go tool vet'.
OPTIONS
- -n
-
The -n flag causes tool to print the command that would be executed but not execute it.
- -x
-
The -x flag causes clean to print remove commands as it executes them.
SEE ALSO
AUTHOR
This manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others).