-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
export unstructured helper function nestedFieldNoCopy #62287
export unstructured helper function nestedFieldNoCopy #62287
Conversation
/ok-to-test |
/assign @deads2k |
/retest |
// it does not exist, or (false, error) if an error is encountered traversing | ||
// obj. | ||
func NestedSliceExists(obj map[string]interface{}, fields ...string) (bool, error) { | ||
val, found, err := nestedFieldNoCopy(obj, fields...) |
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.
Why not just expose this function and let people do what they need to do. These helpers seem overly restrictive for how you can use a thing.
/assign @ash2k |
Lgtm. But would like to hear @ash2k's opinion. Holding until then. /hold |
I think we can merge this as is but I agree with @deads2k - we could expose the underlying helper functions. Maybe do both things - add these two helpers and make those private functions public? |
Unused helpers always seem odd. Having been responsible for a few exposed functions that could be private, I'm fine with exposing I'm assuming it's a external thing or there would be a change to use these functions somewhere in the code-base, right? |
Because the non-object getters give you the |
yes, this is for an external integration. I'd be okay with exposing |
Let's do that. |
Signed-off-by: Steve Kriss <steve@heptio.com>
7125f0f
to
d2e2800
Compare
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, ncdc, skriss 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
cc @roycaihw |
Signed-off-by: Steve Kriss steve@heptio.com
What this PR does / why we need it: Export the unstructured helper function
nestedFieldNoCopy
. This enables checking for existence of nested fields without requiring a deep-copy via JSON.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Special notes for your reviewer:
Release note: