Closed avdienko closed 4 years ago
type Address struct { Street string } func Validate(a *Address) error { return validation.ValidateStruct(a, validation.Field(&a.Street, validation.Required, validation.Length(40, 50).Error("NAME_INVALID_LENGHT")), ) } func main() { a := &Address{ Street: "Krasnaya", } err := Validate(a) fmt.Println(err) // Street: INVALID_LENGHT. }
I do not put a dot in the text of the error, where does it come from? remove her
This is generated by validation.Errors.Error(). You may iterate through Errors to format it in your preferred way.
validation.Errors.Error()
Errors
I do not put a dot in the text of the error, where does it come from? remove her