new check: Err from initialization statement not used #1493
Labels
aggressive
A set of checks that is more prone to false positives but is helpful during code review
new-check
Instead of this:
I recently did this, using a previously declared
err
by mistake:Is this something that staticcheck would be able to detect?
errcheck
already in a way catches this case so arguably that could be enough, buterrcheck
(1) tends to report many "false positives" for errors that we might be ignoring on purpose, and (2) afaik only checks that the return value is assigned to something without caring about the context, missing something like (and this is a contrived example, but to illustrate):Full example: https://go.dev/play/p/0mhNf-1UKEw
The text was updated successfully, but these errors were encountered: