go-validator/validator — pull request #13 by bodokaiser (2014-08-22 10:55:13+00:00)
Title: return custom error type, fixes #9

Breaking change:

**`func Validate(interface{}) error`**
```
err := validator.Validate(foo)

if err != nil {
// print first occurred error
fmt.Printf("error: %s\n", err.Error())
// print all occurred errors
for k, errs := range err.(validator.ErrorMap) {
fmt.Printf("error %s at %s\n", k, errs.Error())
}
}
```

**`func Valid(interface{}) error`**
```
err := validator.Valid("1", "nonzero")

if err != nil {
// print first occurred error
fmt.Printf("error: %s\n", err.Error())
// print all occurred errors
for k, err := range err.(validator.ErrorArray) {
fmt.Printf("error %s\n", k, err.Error())
}
}
```