go-ozzo / ozzo-validation

An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.
MIT License
3.73k stars 224 forks source link

Point at the end of the line #66

Closed avdienko closed 4 years ago

avdienko commented 5 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

qiangxue commented 4 years ago

This is generated by validation.Errors.Error(). You may iterate through Errors to format it in your preferred way.