Skip to content

Commit 4474421

Browse files
committed
website: add 2022.1 release notes
1 parent bebe6f2 commit 4474421

File tree

2 files changed

+49
-10
lines changed

2 files changed

+49
-10
lines changed

website/content/changes/2022.1.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Staticcheck 2022.1 release notes
3+
linkTitle: "2022.1 (v0.3.0)"
4+
weight: -7
5+
---
6+
7+
## Improvements {#improvements}
8+
9+
This release adds support for Go 1.18 and type parameters (generics).
10+
11+
Furthermore, it adds two new flags for handling build tags, `-matrix` and `-merge`. Their use is extensively documented
12+
on the new [Build tags]({{< relref "/docs/running-staticcheck/cli/build-tags" >}}) page. Their intended use is for
13+
avoiding false positives when dealing with different build tags.
14+
15+
Not tied directly to this release, but worth mentioning regardless: Staticcheck has an [official GitHub
16+
Action](https://github.com/dominikh/staticcheck-action) now, which may simplify your CI pipeline.
17+
18+
Minor changes include slightly nicer output from `staticcheck -explain`, better error messages, and allowing whitespace in flags like `-checks`.
19+
20+
## Checks {#checks}
21+
22+
### New checks {#checks-new}
23+
24+
The following new checks have been added:
25+
26+
- {{< check "SA4028" >}} flags `x % 1`, which always yields zero, and is sometimes accidentally used instead of `x % 2`
27+
- {{< check "SA4029" >}} flags misuses of `sort.IntSlice` and related types
28+
- {{< check "SA4030" >}} flags misuses of `math/rand` that always generate zeros
29+
- {{< check "SA4031" >}} flags comparisons of never-nil values against nil
30+
- {{< check "SA9007" >}} flags attempts at deleting system directories
31+
- {{< check "SA9008" >}} flags accidental shadowing in the else branches of type assertions
32+
33+
### Changed checks {#checks-changed}
34+
35+
The following checks have been improved:
36+
37+
- {{< check "S1001" >}} now simplifies more loops
38+
- {{< check "S1038" >}} now simplifies formatted printing in `log` and `testing`, in addition to `fmt`
39+
- {{< check "SA1019" >}} no longer flags deprecated API in the Go standard library if it doesn't know when the API was
40+
deprecated. This is to avoid false positives when using older versions of Staticcheck on newer versions of Go, in
41+
particular Go's `master` branch.
42+
- {{< check "SA1020" >}} no longer flags `net/http.ListenAndServe` with a completely empty address
43+
- {{< check "ST1001" >}} various packages of `github.com/mmcloughlin/avo` have been whitelisted by default
44+
- {{< check "ST1008" >}} no longer flags functions that return `(..., error, bool)`
45+
- {{< check "ST1018" >}} no longer flags emoji sequences
46+
- {{< check "ST1023" >}} no longer makes erroneous suggestions
47+
- Numerous checks have a better understanding of integer literals and can detect mistakes involving unconventional
48+
literals such as `---1` instead of `-1`
49+
- Some runtime crashes have been fixed

website/content/docs/running-staticcheck/cli/build-tags/index.md

-10
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ This will become useful in a bit.
9898

9999
### The `-merge` flag
100100

101-
{{% alert title="Unreleased feature" color="warning" %}}
102-
The `-merge` flag is only available on the master branch of Staticcheck.
103-
It will be part of the next release.
104-
{{% /alert %}}
105-
106101
Using the `-merge` flag, Staticcheck can merge the results of multiple runs.
107102
It decides on a per-check basis whether any run or all runs have to have reported an issue for it to be valid.
108103
It also takes into consideration which files were checked by which run, to reduce false negatives.
@@ -133,11 +128,6 @@ This multi-step workflow of generating per-run output and merging it makes it po
133128

134129
### The `-matrix` flag
135130

136-
{{% alert title="Unreleased features" color="warning" %}}
137-
The `-matrix` flag is only available on the master branch of Staticcheck.
138-
It will be part of the next release.
139-
{{% /alert %}}
140-
141131
With the `-matrix` flag, you can instruct Staticcheck to check multiple build configurations at once and merge the results.
142132
In other words, it automates running Staticcheck multiple times and merging results afterwards.
143133
This is useful when all configurations can be checked on a single system, for example because you don't use cgo.

0 commit comments

Comments
 (0)