LinuxCommandLibrary

go-vet

Static analysis for Go source code

TLDR

Check current package

$ go vet
copy
Check specific package
$ go vet [package]
copy
Check all packages
$ go vet ./...
copy
Run specific analyzer
$ go vet -[analyzer] [package]
copy
List analyzers
$ go vet -help
copy

SYNOPSIS

go vet [options] [packages]

DESCRIPTION

go vet examines Go source code and reports suspicious constructs that the compiler does not catch. It finds bugs like incorrect printf format strings, unreachable code, and misuse of sync primitives.
The tool runs multiple analyzers that check for common mistakes. It is part of the standard quality assurance workflow alongside testing and formatting.

PARAMETERS

PACKAGES

Packages to check.
-json
JSON output.
-c N
Number of errors to show.
--help
Display help information.

CAVEATS

Not exhaustive. False positives possible. Use with tests and code review.

HISTORY

go vet is part of the Go toolchain, providing static analysis for catching common programming errors.

SEE ALSO

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community