-
Notifications
You must be signed in to change notification settings - Fork 13
statusoptional: Embed nil check in checkStatusStruct #91
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
statusoptional: Embed nil check in checkStatusStruct #91
Conversation
Return early from the method when statusType is nil, as we can't reliably expect all callers to check for passed arguments before calling the function. Hopefully fixes kubernetes-sigs#90
0d8f833
to
3bec636
Compare
/lgtm |
Change makes sense, but, do you happen to know which API triggered this? Would be good to be able to add a test case to prevent this regressing in the future |
Sorry, I don't. I've seen the error on https://github.com/k-orc/openstack-resource-controller/ main, if you want to take a look. It's unlikely I'll have a chance to add a regression test this week. |
It looks like it is being triggered by kube-api-linter/pkg/analysis/statusoptional/analyzer.go Lines 243 to 260 in 6df69a1
nil
This is called when checking structs that are inlined: kube-api-linter/pkg/analysis/statusoptional/analyzer.go Lines 116 to 117 in 6df69a1
While this change solves the panic, is there an underlying issue here in attempting to grab a struct type from an inlined field? |
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.
It would be better if you can update the test case for this change.
While we probably also want to merge this check, the root cause is fixed in #92 |
/approve Lets merge this aswell, even though I think #92 resolved the issue |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JoelSpeed, mandre The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Return early from the method when statusType is nil, as we can't reliably expect all callers to check for passed arguments before calling the function.
Hopefully fixes #90