fix StructLevel Parent() (#716)

Co-authored-by: torwang <torwang@tencent.com>
pull/753/merge
Torwang 4 years ago committed by GitHub
parent 0e674563ff
commit 882ec0def4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      validator.go

@ -74,7 +74,7 @@ func (v *validate) validateStruct(ctx context.Context, parent reflect.Value, cur
} }
} }
v.traverseField(ctx, parent, current.Field(f.idx), ns, structNs, f, f.cTags) v.traverseField(ctx, current, current.Field(f.idx), ns, structNs, f, f.cTags)
} }
} }
@ -222,7 +222,7 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
structNs = append(append(structNs, cf.name...), '.') structNs = append(append(structNs, cf.name...), '.')
} }
v.validateStruct(ctx, current, current, typ, ns, structNs, ct) v.validateStruct(ctx, parent, current, typ, ns, structNs, ct)
return return
} }
} }

Loading…
Cancel
Save