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
{{ message }}
Repository navigation
staticcheck: check for mistakenly returning a nil error #640
I think I agree with Ainar. It is impossible for us to determine which conditionals constitute an error condition and which constitute a short-circuit that carries a possibly non-nil error forward.
This might be a good fit for a tool that reports "possibly wrong, look into this" diagnostics, but staticcheck tries to only flag things that are definitely wrong.
Activity
ainar-g commentedon Oct 29, 2019
It looks like this will near-impossible to detect without generating lots of false-positives. A programmer could have easily decided to shorten this:
Into this:
Without it being an error.
dominikh commentedon Nov 5, 2019
I think I agree with Ainar. It is impossible for us to determine which conditionals constitute an error condition and which constitute a short-circuit that carries a possibly non-nil error forward.
This might be a good fit for a tool that reports "possibly wrong, look into this" diagnostics, but staticcheck tries to only flag things that are definitely wrong.
dominikh commentedon Oct 17, 2021
Reopening under the
aggressivelabel, for a future set of checks specific to code review.