@ -111,6 +111,10 @@ func (v *Validate) Field(field interface{}, tag string) ValidationErrors {
v . traverseField ( fieldVal , fieldVal , fieldVal , "" , errs , false , tag , "" )
v . traverseField ( fieldVal , fieldVal , fieldVal , "" , errs , false , tag , "" )
if len ( errs ) == 0 {
return nil
}
return errs
return errs
}
}
@ -122,6 +126,10 @@ func (v *Validate) FieldWithValue(val interface{}, field interface{}, tag string
v . traverseField ( topVal , topVal , reflect . ValueOf ( field ) , "" , errs , false , tag , "" )
v . traverseField ( topVal , topVal , reflect . ValueOf ( field ) , "" , errs , false , tag , "" )
if len ( errs ) == 0 {
return nil
}
return errs
return errs
}
}
@ -321,7 +329,7 @@ func (v *Validate) traverseField(topStruct reflect.Value, currentStruct reflect.
v . traverseMap ( topStruct , currentStruct , current , errPrefix , errs , diveSubTag , name )
v . traverseMap ( topStruct , currentStruct , current , errPrefix , errs , diveSubTag , name )
default :
default :
// throw error, if not a slice or map then should not have gotten here
// throw error, if not a slice or map then should not have gotten here
// bad dive tag usage
// bad dive tag
panic ( "dive error! can't dive on a non slice or map" )
panic ( "dive error! can't dive on a non slice or map" )
}
}
}
}