What happened?
when using
package main
import (
"errors"
"fmt"
val "github.com/go-playground/validator/v10"
)
type S struct {
A string `validate:"validateFn"`
}
func (s *S) Validate() error {
return errors.New("huha")
}
func main() {
var s S
e := val.New().Struct(&s)
fmt.Printf("%v", e)
}
on a struct field A, the Validate() error function is called but the error returned from that function is never accesible in the result e.
Only an error:
Key: 'A' Error:Field validation for 'A' failed on the 'validateFn' tag"
is printed.
Also casting to validation.ValidationError does not help.
Version
10.30
Example Code
What happened?
when using
on a struct field
A, theValidate() errorfunction is called but the error returned from that function is never accesible in the resulte.Only an error:
is printed.
Also casting to
validation.ValidationErrordoes not help.Version
10.30
Example Code