Skip to content

Instantly share code, notes, and snippets.

@aaronjwood
Created July 25, 2021 08:09
Show Gist options
  • Save aaronjwood/98cf21e031566909d15b52514b4a849a to your computer and use it in GitHub Desktop.
Save aaronjwood/98cf21e031566909d15b52514b4a849a to your computer and use it in GitHub Desktop.
Searching an unstructured
func search(unstruct *unstructured.Unstructured, fields ...string) (interface{}, bool, error) {
field, found, err := unstructured.NestedFieldCopy(unstruct.Object, fields...)
if err != nil {
return "", found, err
}
return field, found, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment