Coding

Staticcheck – advanced Go linter

Staticcheck is an advanced static analysis tool for Go. It finds bugs and performance problems, suggests code simplifications and checks compliance with common style conventions.

The tool provides more than 150 checks while deliberately favouring actionable diagnostics and a low false-positive rate. It understands the Go version targeted by a module, so suggestions and standard-library checks are adjusted accordingly.

Staticcheck works with the same package patterns used by the Go toolchain and can be used from the command line, editors and continuous integration systems.

This is free and open source software.

Key Features

  • Go-version-aware analysis avoids recommending language and standard-library features unavailable to the target project.
  • Understands modern Go features including generics and current standard-library deprecations.
  • Configurable check selection through staticcheck.conf, command-line options and source directives.
  • Provides detailed explanations for individual diagnostics with the -explain option.
  • Supports standard Go package patterns, allowing individual packages or complete module trees to be analysed.
  • Offers several output formats for command-line, editor and automated workflows.
  • Designed for CI use with an emphasis on precise diagnostics and few false positives.
  • Supports Go’s external build-cache protocol through GOCACHEPROG.

Website: github.com/dominikh/go-tools
Support:
Developer: Dominik Honnef
License: MIT License

Staticcheck flags

Staticcheck 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 Explore our carefully curated directory of recommended free and open source software, covering every major software category.

The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more.

Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted