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
-explainoption. - 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 is written in Go. Learn Go with our recommended free books and free tutorials.
Related Software
| Go Linters | |
|---|---|
| revive | Designed as a drop-in replacement for golint |
| golangci-lint | Fast Go linters runner |
| gosec | Security scanner for Go projects |
| Staticcheck | Advanced Go linter |
| go-critic | Opinionated Go source code linter |
| Vet | Examines Go source code and reports suspicious constructs |
| gofumpt | Stricter gofmt |
| gofmt | Formats Go programs |
| goconst | Find repeated Go literals that could be replaced with constants |
| go-ruleguard | Analysis-based Go linter that runs dynamically loaded rules |
| sloglint | Enforce consistent structured logging conventions in Go |
| forbidigo | Go linter for forbidding identifiers |
| godot | Keep source code comments consistent |
| Godoc-Lint | Enforce consistent documentation comments in Go code |
| exhaustive | Check Go switch statements for missing enum cases |
Read our verdict in the software roundup.
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. |


Please read our Comment Policy before commenting.