[Bug]: `validateFn` does not propagage errors upwards
Author: gabyxCreated May 13, 2026Updated May 18, 2026
Labelsbug
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
see above.Source: go-playground/validator