Skip to content

Staticcheck 2023.1.1 (v0.4.1)

Compare
Choose a tag to compare
@dominikh dominikh released this 14 Feb 10:33
· 116 commits to master since this release
2023.1.1

This release fixes a crash, a false positive in U1000 (issue 1360) and improves the way deprecated API is flagged (issue 1318).

When targeting a Go version that is older than the version that deprecated an API, SA1019 will no longer flag the use even if there is already an alternative available in the targeted Go version.

For example, math/rand.Seed has been deprecated in Go 1.20, but an alternative has existed since Go 1.0. In the past, we would flag uses of Seed even if targeting e.g. Go 1.19, to encourage better forwards compatibility. This can lead to unnecessary churn, however, because the correct change may depend on the Go version in use. For example, for Seed before Go 1.20, the alternative is to use a separate instance of math/rand.Rand, whereas in Go 1.20, a possible alternative is to simply drop the call to Seed.