File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -384,7 +384,11 @@ func (d *StructData) parseRulesFromTag(v *Validation) {
384384 fValue = removeValuePtr (fValue )
385385
386386 // Check if the reflect.Value is valid and not a nil pointer
387- if ! fValue .IsValid () || fValue .IsNil () {
387+ if ! fValue .IsValid () || (ft .Kind () == reflect .Slice && fValue .IsNil ()) {
388+ continue
389+ }
390+ // perf: skip parse on elements is simple kind
391+ if reflects .IsSimpleKind (ft .Elem ().Kind ()) {
388392 continue
389393 }
390394
Original file line number Diff line number Diff line change @@ -1775,3 +1775,14 @@ func TestIssues_276(t *testing.T) {
17751775 fmt .Println (v .Errors .OneError ()) // returns a random error
17761776 fmt .Println (v .Errors .Field ("Age" )) // returns error messages of the field
17771777}
1778+
1779+ // https://github.com/gookit/validate/issues/280
1780+ func TestIssues_280 (t * testing.T ) {
1781+ type TestData struct {
1782+ ID mockUUID
1783+ }
1784+
1785+ data := TestData {}
1786+ v := validate .New (data )
1787+ assert .Nil (t , v .ValidateErr ())
1788+ }
You can’t perform that action at this time.
0 commit comments