go-validator/validator

use error struct over map[string][]error

bodokaiser opened this issue · 0 comments

I see this is controversy but I give it a try:

type ValidationError struct {
    Errors map[string][]error
}

// Returns first error.
func (err ValidationError) Error() {
    for k, errs := range err.Errors {
        return k + " value had " + errs[0].Error()
    }
}