mirror of
https://github.com/kubernetes/client-go.git
synced 2026-05-14 11:03:14 +00:00
switch tag Get("json") to Lookup("json")
Kubernetes-commit: ef2e578f14fe666eb8a7296ea19f8284c1df5e7b
This commit is contained in:
committed by
Kubernetes Publisher
parent
a16e1bb854
commit
06945f2b0e
@@ -361,7 +361,7 @@ func (j *JSONPath) findFieldInValue(value *reflect.Value, node *FieldNode) (refl
|
||||
var inlineValue *reflect.Value
|
||||
for ix := 0; ix < t.NumField(); ix++ {
|
||||
f := t.Field(ix)
|
||||
jsonTag := f.Tag.Get("json")
|
||||
jsonTag, _ := f.Tag.Lookup("json")
|
||||
parts := strings.Split(jsonTag, ",")
|
||||
if len(parts) == 0 {
|
||||
continue
|
||||
@@ -369,7 +369,7 @@ func (j *JSONPath) findFieldInValue(value *reflect.Value, node *FieldNode) (refl
|
||||
if parts[0] == node.Value {
|
||||
return value.Field(ix), nil
|
||||
}
|
||||
if len(parts[0]) == 0 {
|
||||
if len(parts[0]) == 0 && f.Anonymous {
|
||||
val := value.Field(ix)
|
||||
inlineValue = &val
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user