fix(decode): let the later field win an equal-depth name clash

Assisted-by: GLM 5.3
This commit is contained in:
2026-09-17 23:07:27 +02:00
parent 54c6032a9a
commit bb238c98c3
3 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -289,7 +289,7 @@ func newStructSchema(t reflect.Type) structSchema {
name = f.Name
}
key := strings.ToLower(name)
if existing, ok := s.byName[key]; !ok || depth < existing.depth {
if existing, ok := s.byName[key]; !ok || depth <= existing.depth {
s.byName[key] = structFieldLoc{index: path, depth: depth}
}
}