-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add nil check when applying variadic client options #806
Comments
/kind cleanup |
@vincepri: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed 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. |
@rajathagasthya its not possible to pass nil as a last argument to variadic function
https://play.golang.org/p/8iOacL4kOvX this example will throw an error.
|
@boddumanohar |
created a PR for this. |
Repeating my comment from the PR in #813 , IMHO we shouldn't be doing this:
|
@rajathagasthya WDYT, does that make sense? |
Discussed in #813. Closing based on preference not to add this check. |
/close |
All of the
Create
,List
,Update
andDelete
client methods are variadic in that it takes any number of options. For example:It's too easy to pass
nil
as the last argument for these methods and then it blows up with a NPE inApplyOptions
method. Example:controller-runtime/pkg/client/options.go
Line 141 in 19e72eb
There needs to be a nil check when options are applied.
The text was updated successfully, but these errors were encountered: