LinuxCommandLibrary

vet

Go static analysis tool

TLDR

Check package

$ go vet
copy
Check specific file
$ go vet [file.go]
copy
Check all packages
$ go vet ./...
copy
Specific check
$ go vet -printf [file.go]
copy
JSON output
$ go vet -json [file.go]
copy

SYNOPSIS

go vet [-n] [-x] [-json] [packages]

DESCRIPTION

go vet performs static analysis on Go source code to find common programming mistakes that the compiler does not catch. It checks for issues such as incorrect printf format strings, unreachable code, suspicious function calls, and misuse of sync primitives.
The tool is part of the standard Go toolchain and runs without executing the code. It is typically used alongside tests and linters as part of a continuous integration workflow to catch bugs early in development.

PARAMETERS

-n

Print commands.
-x
Print commands as run.
-json
JSON output.
-all
Run all analyzers.
./...
All packages.

CAVEATS

Go-specific. Not all bugs found. Use with tests.

HISTORY

go vet is part of the Go toolchain, providing static analysis to find common programming mistakes.

SEE ALSO

go(1), golint(1), staticcheck(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community