Closed
Description
hi, i am new in golang, maybe that problem about me.
when i use validator.Struct() in a function that return named error, the err var always not nil
func ValidateStruct(v interface{}) (err error) {
err = validate.Struct(v)
return
}
but when i use it like this, it works
func ValidateStruct(v interface{}) (err error) {
errs := validate.Struct(v)
if errs != nil {
err = errs
return
}
return nil
}
so what the problem ?