Open FiloSottile opened 2 weeks ago
ISTM that we already catch this?
bar.go:7:10: this comparison is never true (SA4023)
bar.go:6:2: the lhs of the comparison is the 1st return value of this function call
bar.go:10:6: command-line-arguments.foo never returns a nil interface value
The following program prints
false
because thefoo()
return value is always a non-nil interface wrapping a nilbar()
return value.Today I was about to ship something similar to an exposed standard library interface when a test stopped me.
Not sure it can be done with few enough false positives, but I would have loved for staticcheck to point out that
foo()
always returns non-nil, which given the error return is almost certainly not intended.