vet
Go static analysis tool
TLDR
SYNOPSIS
go vet [-n] [-x] [-json] [-vettool prog] [packages]
DESCRIPTION
go vet examines Go source code and reports suspicious constructs that the compiler does not catch, using heuristics that do not guarantee all reports are genuine problems. It checks for issues such as incorrect printf format strings, unreachable code, suspicious function calls, misuse of sync primitives, and incorrect struct tags.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. Individual analyzers can be enabled or disabled (e.g., `-printf=false`). Run `go tool vet help` to see available analyzers and their flags.
PARAMETERS
-n
Print commands that would be executed, but do not run them.-x
Print commands as they are executed.-json
Output diagnostics in JSON format.-vettool prog
Select a different analysis tool with alternative or additional checks.-c int
Display offending line with this many lines of context../...
Wildcard that matches all packages in the current module recursively.
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), go-vet(1), go-build(1), golint(1), staticcheck(1)
