Skip to content

Commit

Permalink
chore: some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
utahta committed May 14, 2019
1 parent 3c2abde commit 820a480
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ func (v *Validator) validate(ctx context.Context, field Field, chunk *tagChunk)
for _, tag := range chunk.GetTags() {
valid, err := tag.validateFn(ctx, field, FuncOption{Params: tag.params, v: v})
if !valid || err != nil {
errs = append(errs, &fieldError{field: field, tag: tag, err: err, suppressErrorFieldValue: v.suppressErrorFieldValue})
errs = append(errs, &fieldError{
field: field,
tag: tag,
err: err,
suppressErrorFieldValue: v.suppressErrorFieldValue,
})
}
}

Expand Down Expand Up @@ -289,7 +294,7 @@ func (v *Validator) canValidate(rawTag string, kind reflect.Kind) bool {
reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr,
reflect.Float32, reflect.Float64:
// these kinds do not perform recursive process so let's skip validation
// these kinds do not perform recursive process so let's skip validating.
return false
}
}
Expand Down

0 comments on commit 820a480

Please sign in to comment.