You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: