Skip to content

Commit 882ec0d

Browse files
Torwang1torwang
andauthored
fix StructLevel Parent() (#716)
Co-authored-by: torwang <[email protected]>
1 parent 0e67456 commit 882ec0d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

validator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (v *validate) validateStruct(ctx context.Context, parent reflect.Value, cur
7474
}
7575
}
7676

77-
v.traverseField(ctx, parent, current.Field(f.idx), ns, structNs, f, f.cTags)
77+
v.traverseField(ctx, current, current.Field(f.idx), ns, structNs, f, f.cTags)
7878
}
7979
}
8080

@@ -222,7 +222,7 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
222222
structNs = append(append(structNs, cf.name...), '.')
223223
}
224224

225-
v.validateStruct(ctx, current, current, typ, ns, structNs, ct)
225+
v.validateStruct(ctx, parent, current, typ, ns, structNs, ct)
226226
return
227227
}
228228
}

0 commit comments

Comments
 (0)