switch tag Get("json") to Lookup("json")

Kubernetes-commit: ef2e578f14fe666eb8a7296ea19f8284c1df5e7b
This commit is contained in:
Jordan Liggitt
2026-04-07 18:12:54 -04:00
committed by Kubernetes Publisher
parent a16e1bb854
commit 06945f2b0e

View File

@@ -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
}