UI improvements

The new -list-checks flag lists all available checks, showing each check's identifier and one-line description. You can use the existing -explain flag to find out more about each individual check.

Targeted Go version

Some checks in Staticcheck adjust their behavior based on the targeted Go version. For example, the suggestion to use for range instead of for _ = range does not apply to Go 1.3 and earlier.

In the past, the default Go version that was targeted was the version that Staticcheck had been compiled with. For most users, this meant that it targeted the latest Go release. Going forward, we will default to the Go version declared in go.mod via the go directive. Even though this value does not exactly correspond to the module's minimum supported Go version, it is still a better apprximation than whatever Go version Staticcheck has been compiled with, and should work fine for most users.

As before, the targeted Go version can be explicitly set by using the -go flag.

Checks

New checks

The following new checks have been added:

Changed checks

The following checks have been improved:

Restructured documentation

The documentation on the website has been restructured and hopefully made more approachable. Instead of being one long document, it is now split into multiple smaller articles. In the future, more articles that look at specific aspects of Staticcheck will be added.

Better integration with gopls

Several behind the scenes changes prepare this release for better integration with gopls. This will include more accurate severities for diagnostics as well as numerous new refactorings. These improvements will be part of a future gopls release.

Deletion of rdeps

The rdeps tool has been deleted. This was a GOPATH-centric tool that allowed finding all reverse dependencies of a Go package. Both the move to Go modules as well as the emergence of much better tooling for inspecting dependencies (such as goda) has made rdeps redundant.

Staticcheck 2021.1.1 release notes

This release adds support for new language features in Go 1.17, namely conversions from slices to array pointers, the unsafe.Add function, and the unsafe.Slice function.

Additionally, it fixes the following false positives: