-
Notifications
You must be signed in to change notification settings - Fork 214
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
logcheck: do not error out if no Go files present #220
Conversation
Exit with code 0 when the provided package has no Go files and code 1 for all other errors. Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
Welcome @umangachapagain! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: umangachapagain The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @adisky |
@@ -35,6 +38,7 @@ var Analyzer = &analysis.Analyzer{ | |||
} | |||
|
|||
func main() { | |||
handleErrors() | |||
singlechecker.Main(Analyzer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the error is coming from singlechecker.Main(Analyzer)
and it is exiting with exit code 1 while package loading. singlechecker.Main(Analyzer)
would be called anyways after handleErrors(), so it will fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleErrors()
will exit with code 0 for no Go files
error and code 1 for all other errors. So singlechecker.Main(Analyzer)
will never be called if there is an error while loading package.
I don't like this approach because we're duplicating what checker
does. But, in current state that looks like the only way to me. We can discuss on other alternatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, it might slow down the tool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but it's either that or we error out from the checker.
The error is coming from klog/hack/tools/logcheck/main.go Lines 37 to 39 in 407242c
cc @ehashman @serathius @navidshaikh do you have any suggestions here? or we should mark it as won't fix. references for singlechecker package. |
We should probably mark it as won't fix. |
/retitle logcheck: do not error out if no Go files present
The issue I filed doesn't suggest we try to load empty packages. I asked to ensure that we don't fail when we try to test an empty package, because an empty package can't possibly require a log migration. This is especially important for when we reverse the CI script's logic to fail any directory that isn't an explicitly allowed failure. We will have much less control over input at that point. I suspect the best way to accomplish this may be to always return true if given a path that contains no Go files before starting the rest of the program logic. This would constitute input validation and is not the way the PR is currently written. |
I understand the issue doesn't suggest that we try to load empty packages. But, I don't know a way to find an empty package without trying to load it.
I have some questions. But, before I ask those I'd like to know your view on how we do this? |
@umangachapagain: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/close |
@umangachapagain: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
Exit with code 0 when the provided package has no Go files
and code 1 for all other errors.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #214
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
Release note: