--- title: Staticcheck 2026.2 release notes linkTitle: "2026.2 (v0.8.0)" weight: -12 --- ## Added support for Go 1.27 This release updates Staticcheck's database of deprecated standard library APIs to cover Go 1.27. Furthermore, it adds support for two new language features: [generic methods](https://tip.golang.org/issue/77273) and struct initializers with [direct references to embedded fields](https://github.com/golang/go/issues/9859) ## Support for GOCACHEPROG Staticcheck now supports the same `GOCACHEPROG` environment variable and protocol as the `go` tool. This allows users to provide their own implementation of the build/fact/diagnostic cache. ## Case-insensitive check names All places that accept names of checks, such as the `-checks` and `-explain` flags, ignore directives, and the `checks` setting in configuration files now ignore the case of the provided names. That is, `SA1000`, `sa1000`, and `sA1000` all refer to the same check. ## Performance improvements for some packages We have made changes to better support code with very complex control flow graphs, such as the output of wasm2go. In one particularly pathological case, memory usage was reduced from 10 GiB to 1.5 GiB and wall time from 73 s to 13 s. ## Checks ### New checks One new check has been added. {{< check "SA9010" >}} flags statements of the form `defer foo()` where `foo` returns a function. Usually, functions like that expect the user to defer calling the returned function. For example: ```go // Start starts a thing. The returned function has to be called once the thing // is no longer needed. func Start() func() { // do some work here return func() { // undo some work here } } func user() { // This is doubly wrong! It won't call Start until this function returns, // and then it won't call the function returned by Start. defer Start() ... } ``` ### Changed checks The following checks have been improved: - {{< check "SA1019" >}} now flags uses of deprecated fields in struct initializers. Additionally, it is more consistent in the way diagnostics are formatted ({{< issue"" >}}). - {{< check "SA1026" >}} and {{< check "SA9005" >}} now check calls to `MarshalIdent` functions, too ({{< issue "" >}}). - {{< check "SA4003" >}} now checks comparisons involving generics. - {{< check "SA4006" >}} has gained support for compound operators (`+=`, `^=`, etc) as well as postfix increment and decrement ({{< issue "" >}}). - {{< check "SA4023" >}} has been reimplemented. As a result, it may find new issues in existing code, but also miss issues it has found before. - {{< check "SA5011" >}} has been disabled due to internal changes. It is unclear whether it will be enabled again in the future. As an alternative, gopls contains the [nilness](https://go.dev/gopls/analyzers#nilness-check-for-redundant-or-impossible-nil-comparisons) analyzer, which has similar checks. - {{< check "SA6005" >}} emits a clearer diagnostic when the result of `strings.EqualFold` has to be inverted ({{< issue "" >}}). - Documentation has been added to several checks ({{< check "SA1002" >}}, {{< check "SA1012" >}}, {{< check "SA1014" >}}, {{< check "SA1020" >}}, {{< check "SA2000" >}}, {{< check "SA2003" >}}, and {{< check "SA4010" >}}) - {{< check "S1005" >}} no longer flags unnecessary assignments to the blank identifier for map indexing. This is to allow `v, _ := m[k]` as a hint that the key may be missing from the map but that using the zero value is fine. - {{< check "U1000" >}} has gained better support for the combined use of generics and interfaces. It should emit far fewer false positives now ({{< issue "1616" >}}, {{< issue "1440" >}}, {{< issue "1294" >}}). - {{< check "ST1001" >}} includes the new `simd/archsimd` package in the default value of the `dot_import_whitelist` setting. ## Staticcheck 2026.2.1 release notes {#2026.2.1} This release fixes two false positives in {{< check "SA4023" >}} that were introduced with 2026.2: - It no longer treats unconstrained generics as never nil ({{< issue "1736" >}}). - It no longer triggers in situations that don't involve typed nils ({{< issue "1737" >}}).