x/tools/go/analysis/passes/nilness: bogus "impossible condition: non-nil == nil" that is actually possible #66835
Labels
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Go version
go version go1.21.3 linux/amd64
Output of
go env
in your module/workspace:What did you do?
The following minimal example function
triggers a "impossible condition: non-nil == nil (nilness) cond" warning by the nilness analyser.
I'm using vscode with its own gopls integration (which, as opposed to calling go vet (by default, unless opted-in) actually performs nilness analysis, as far as I understand).
Of course, the nilness check is actually not bogus:
Calling
F[error](nil)
will happily run panic(0).I suspect the analyser somehow thinks T is a non-interface type.
What did you see happen?
An impossible condition: non-nil == nil nilness (cond) warning flagged by my IDE
What did you expect to see?
no warning.
The text was updated successfully, but these errors were encountered: