Vet – examines Go source code and reports suspicious constructs

Vet is the static analysis tool supplied with Go. It examines source code for suspicious constructs which compile successfully but are likely to represent programming errors.

The tool uses a collection of analyzers covering areas such as formatted output, struct tags, unreachable code, misuse of synchronization primitives, incorrect test functions and potentially unsafe operations.

Vet is normally invoked with go vet and accepts the same package patterns used elsewhere in the Go toolchain.

This is free and open source software.

Key Features

  • Checks Go source for suspicious constructs and likely programming mistakes which are not necessarily compiler errors.
  • Includes analyzers for formatted output, struct tags, unreachable code, lost context cancellation, unsafe pointers and synchronization mistakes.
  • Checks common testing mistakes, malformed build directives and incorrect uses of standard-library APIs.
  • Supports analysing individual packages or complete package trees using normal Go package patterns.
  • Can emit diagnostics as JSON for integration with development tools.
  • Can apply supported suggested fixes directly to source code or display them as unified diffs.
  • Supports alternative and additional analyzers through the -vettool mechanism.
  • Individual analyzers can be enabled, disabled and configured where appropriate.

Website: pkg.go.dev/cmd/vet
Support:
Developer: Go team
License: BSD 3-Clause License

vet

Vet is written in Go. Learn Go with our recommended free books and free tutorials.


Related Software

Go Linters
reviveDesigned as a drop-in replacement for golint
golangci-lintFast Go linters runner
gosecSecurity scanner for Go projects
StaticcheckAdvanced Go linter
go-criticOpinionated Go source code linter
VetExamines Go source code and reports suspicious constructs
gofumptStricter gofmt
gofmtFormats Go programs
goconstFind repeated Go literals that could be replaced with constants
go-ruleguardAnalysis-based Go linter that runs dynamically loaded rules
sloglintEnforce consistent structured logging conventions in Go
forbidigoGo linter for forbidding identifiers
godotKeep source code comments consistent
Godoc-LintEnforce consistent documentation comments in Go code
exhaustiveCheck Go switch statements for missing enum cases

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted