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
In this reddit discussion, /u/jerf has a nice suggestion: label lines that should be impossible to reach to improve coverage. Something like follows:
res, err := prudentFunction("constant") if err != nil { panic(fmt.Sprintf("The impossible has happened: %v", err)) // gocover: Ignore }
The coverage tool could then instrument the line and ignore it if there are 0 passes, and issue an error if there were more than zero.
The text was updated successfully, but these errors were encountered:
CC @robpike
Sorry, something went wrong.
No, thanks. I dislike tools forcing people to annotate their code to silence them. That is, I dislike these annotations - they're not about the code, only about the tools that analyze the code.
No branches or pull requests
In this reddit discussion, /u/jerf has a nice suggestion: label lines that should be impossible to reach to improve coverage. Something like follows:
The coverage tool could then instrument the line and ignore it if there are 0 passes, and issue an error if there were more than zero.
The text was updated successfully, but these errors were encountered: