Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

staticcheck: catch when a defer stores an error into the ether #590

Open
mvdan opened this issue Sep 15, 2019 · 1 comment
Open

staticcheck: catch when a defer stores an error into the ether #590

mvdan opened this issue Sep 15, 2019 · 1 comment

Comments

@mvdan
Copy link
Sponsor Contributor

mvdan commented Sep 15, 2019

For example, https://go-review.googlesource.com/c/go/+/194638 fixes a nasty bug where ParseExprFrom would completely ignore errors under some scenarios, because the author forgot to name the result parameter err error.

This would be a tricky rule to write, but if done well, it could catch nasty hidden bugs.

Filing this issue to keep track of past examples that have been fixed, as well as false positives we should look out for.

@mvdan mvdan added the needs-triage Newly filed issue that needs triage label Sep 15, 2019
@dominikh dominikh added new-check and removed needs-triage Newly filed issue that needs triage labels Sep 15, 2019
@dominikh dominikh changed the title catch when a defer stores an error into the ether staticcheck: catch when a defer stores an error into the ether Sep 15, 2019
@dominikh
Copy link
Owner

Examples of potential false positives that make this check non-trivial to implement: https://play.golang.org/p/9CYioVVhzV9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants