-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/vet or golint: Catch TestMain without os.Exit #9917
Comments
Note that this can lead to false positives when the os.Exit call is in a helper function, possibly in another package. |
Though of course that can be greatly reduced by checking that m.Run is called directly in TestMain and whether its return value is discarded or not. |
Do we need to check if the method is in I'm creating a CL which only checks that the return value is used. This will detect most common issues (but not
I skimmed parts of stdlib but didn't find any obvious other candidates as serious as
|
CL https://golang.org/cl/37968 mentions this issue. |
The unusedresults module in vet is not well designed. I'd prefer to see a redesign that generalizes better, rather than adding special features for every function we can think of that needs its results used. |
@robpike OK, I'm not sure what you're after. Just to play around, I added interface support and moved everything to a single argument, but I do not know types package, so I guess there are issues with the code, besides requiring cleanup.
Are there any other classes of unused results you think it should catch? |
Since #34129 is an accepted proposal, I believe this can be closed. |
Thanks. |
Saw someone do this today:
which, naturally, gives false positives for test success.
The text was updated successfully, but these errors were encountered: