LinuxCommandLibrary

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
copy


Check the Go package in the specified path
$ go vet [path/to/file_or_directory]
copy


List available checks that can be run with go vet
$ go tool vet help
copy


View details and flags for a particular check
$ go tool vet help [check_name]
copy


Display offending lines plus N lines of surrounding context
$ go vet -c=[N]
copy


Output analysis and errors in JSON format
$ go vet -json
copy

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

go-fmt(1), go-fix(1).

AUTHOR

This manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others).

Copied to clipboard