-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mandre 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 |
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? |
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