-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
'unused' check should not reason about control flow #2515
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello, Thank you for your report, https://github.com/dominikh/go-tools/blob/master/unused/unused.go So I recommend opening an issue on ping @dominikh |
This is dominikh/go-tools#633 (and changing how |
Thank you @dominikh 👍 I will close this issue as the problem is already declared on staticcheck. |
Thanks. Perhaps the bug report template could remind ill-informed bug reporters such as me to consider reporting the bug upstream for certain components, with a link to details. |
We already have a checkbox about that 😸 and you checked this box 😸
Maybe the sentence is not enough clear. |
Right you are! Sorry for missing that. For some reason I interpreted that to mean: did I run the command-line tool directly against a micro test case (as opposed to e.g. seeing a failure in a CI system's logs)? Perhaps it could be phrased something like this: [x] This is a problem in the golangci-lint driver and not one of its linter plugins. It might be worth a paragraph in the main README file explaining whether this repo hosts original linters, or merely repackages upstream ones in a new driver, or does a mix of both, and link to the two sets (internal, external). |
Welcome
Description of the problem
Adding a call to (*testing.T).Skip into a test function causes the 'unused' analysis to report various functions as unused, specifically, those whose sole call is made dynamically unreachable by the Skip call:
While it is indeed clever that the 'unused' analysis knows that Skip never returns and is able to make deductions based on the control-flow graph, it not helpful to the user, who must now find a devious way to work around the check, such as this:
'unused' should use the static reference graph. It should not care about control flow.
Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
// add your code here
The text was updated successfully, but these errors were encountered: