Adds ProviderResource Nil Checks#216
Conversation
There was a problem hiding this comment.
you probably also want to check if gatewayClasses is nil or not to handle the case when there are no more gateway classes left / the subscribe notification was triggered due to a delete
There was a problem hiding this comment.
imho this should ideally not be happening, but rather than skip it, we should either
- log it or
- return early and empty
to surface the underlying issue faster
There was a problem hiding this comment.
I agree we shouldn't be seeing nil gateways, so I'd actually be in favor of doing
if gateway == nil {
// Log some message here
panic
}There was a problem hiding this comment.
There was a problem hiding this comment.
Same for me, I'd rather see a panic than a continue.
youngnick
left a comment
There was a problem hiding this comment.
Thanks for finding, I think we should be brutal here and just panic if we get nil values, something has gone seriously wrong, and I'd rather find those cases now before v0.2.0.
There was a problem hiding this comment.
I agree we shouldn't be seeing nil gateways, so I'd actually be in favor of doing
if gateway == nil {
// Log some message here
panic
}There was a problem hiding this comment.
Same for me, I'd rather see a panic than a continue.
|
@arkodg @youngnick commit b35f07f implements your feedback. However, I am seeing nil gatewayclasses, gateways, and httproutes in my e2e testing so we have an issue elsewhere in the code that must be resolved. |
There was a problem hiding this comment.
nit: this is functionally correct, but I still prefer the if ... else if.... else style here, didgolangci-lint suggest this style :) ?
There was a problem hiding this comment.
I find switch statements easier to read.
There was a problem hiding this comment.
I missed this before, but switch statements are generally more idiomatic in Go for more than one if statement.
Signed-off-by: danehans <daneyonhansen@gmail.com>
|
@arkodg I had to rebase. Please retag. |
Adds nil checks for
ProviderResourcesgatewayclasses, gateways, and httproutes.Fixes #214
Signed-off-by: danehans daneyonhansen@gmail.com