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

detect function that returns an error that's not checked #1057

Closed
lolopinto opened this issue Jul 27, 2021 · 1 comment
Closed

detect function that returns an error that's not checked #1057

lolopinto opened this issue Jul 27, 2021 · 1 comment

Comments

@lolopinto
Copy link

since go doesn't have exceptions, it's easy for a function that returns an error to be missed by callers

e.g.

func foo() error {
  return nil
}

func bar() {
  foo()  // should be flagged!
 // do something else.
}

func bar2() {
  // yay!
  if err := foo(); err != nil {
    log.Fatal(err) 
 }
 // do something else.
}
@lolopinto lolopinto added the needs-triage Newly filed issue that needs triage label Jul 27, 2021
@dominikh
Copy link
Owner

That is errcheck's domain. It does not fit into Staticcheck because it has too many false positives in the real world.

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