GO-VET(1)

πŸ’… go-vet(1) β€” the manual, but make it make sense

okay bestie, we're doing the GO-VET page. this is a Go programming tools and commands situation and honestly? it's giving "your code has opinions and so do we." πŸ¦‹


✨ NAME ✨

go-vet β€” report likely mistakes in packages. that's it, that's the whole personality. your code's little snitch, but in a helpful way 🫢


πŸ‘€ SEE ALSO πŸ‘€ (yes it's up here, we don't make the rules)

go vet [build flags] [-vettool prog] [vet flags] [packages]

that's the shape of it. flags, tool, flags, packages. iconic order honestly ✨


🌸 DESCRIPTION 🌸

Vet runs the Go vet tool (cmd/vet) on the named packages and reports diagnostics. so like. you point it at your packages, it reads them, and it comes back with "hey girl this looks sus" β€” except professionally πŸ’…


πŸŽ€ OPTIONS πŸŽ€

It supports these flags, and we are listing all of them, no skips, no cap:

  • -c int β€” display offending line with this many lines of context (default -1). yes, it's an int, yes the default is -1, that's literally what it says πŸ“
  • -json β€” emit JSON output. for when you want your diagnostics machine-readable and honestly kind of aesthetic πŸ“‹
  • -fix β€” instead of printing each diagnostic, apply its first fix (if any). note the "if any" bestie, some diagnostics just don't come with a fix ✨
  • -diff β€” instead of applying each fix, print the patch as a unified diff. so you can look at the patch before you commit to it πŸ™ˆ

πŸ› οΈ the -vettool=prog moment πŸ› οΈ

The -vettool=prog flag selects a different analysis tool with alternative or additional checks. you're not stuck with the default, you can swap in your own girlies πŸ”₯

For example, the shadow analyzer can be built and run using these commands:

go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
go vet -vettool=$(which shadow)
real talk: Alternative vet tools should be built atop golang.org/x/tools/go/analysis/unitchecker, which handles the interaction with go vet. that's the contract, don't skip it.

πŸ” the default tool πŸ”

The default vet tool is go tool vet or cmd/vet. that's who's showing up when you don't specify anyone πŸ’…

  • For help on its checkers and their flags, run go tool vet help.
  • For details of a specific checker such as printf, see go tool vet help printf. (yes literally just say the checker's name, it's so simple slay ✨)
  • For more about specifying packages, see go help packages.

🌈 build flags, bestie 🌈

The build flags supported by go vet are those that control package resolution and execution, such as -C, -n, -x, -v, -tags, and -toolexec. write those down. every single one. -C, -n, -x, -v, -tags, -toolexec πŸ‘‘

For more about these flags, see go help build.


πŸ’– SEE ALSO πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

This manual page was created using help2man and afterwards updating the output. It is maintained by the Debian Go Compiler Team <team+go-compiler@tracker.debian.org> for the Debian project (and may be used by others).

the "created using help2man and afterwards updating the output" is lowkey the most relatable origin story ever and I respect it 🫢


and that's the whole page, diva πŸ¦‹ go forth, run go vet, let it read you to filth (lovingly). mwah πŸ’‹

this has been Go 1.27, August 2026, GO-VET(1) β€” thanks for coming to my ted talk ✨⭐🌈

πŸ“¦ where this page comes from