Dominik Honnef
Dominik Honnef
Users have reported that Staticcheck fails to load export data from Go's cache if other Go builds/tests are running concurrently with Staticcheck. It is my understanding that the design of...
A common mistake among beginners is to wrap a lot of code in an `if`, instead of using an early return. The most egregious, and easiest to flag, instance of...
Converting to `unsafe.Pointer` marks all fields in the converted struct as used. However, with type parameters, we don't always know the concrete type: ``` type S1 struct{ a int }...
Some operations mark all fields in a struct as used, because we can't do any better. One example is converting to `unsafe.Pointer` – who knows what the user will do...
In go/types, instantiated functions do not have an associated `types.Object`. For ``` func Fn1[T any](x T) {} func Fn2() { Fn1[int](0) } ``` in `Fn2`, `info.ObjectOf(Fn1)` will return the parameterized...
The rewrite of unused no longer flags the following code: ``` package pkg var x = [3]int{1,2,3} ``` This is caused by the SSA that go/ssa produces: ``` func init():...
From an actual bug I wrote: ``` foo := make([]int, 0, n) for _, x := range foo { ... } ``` The usual caveats apply (e.g. `0` should be...
We should automatically use the latest released versions of Staticcheck and staticcheck-action in the documentation. Probably via a combination of generating data files in `build.sh` and using these in our...
These checks verify json.Marshal, xml.Marshal, and related functions, but they are missing at least json.MarshalIndent.
``` -- go.mod -- module example.com/sand2 go 1.17 -- sand.go -- package pkg import ( _ "bytes" ) -- sand_test.go -- package pkg import ( _ "example.com/sand2" ) ``` ```...