Closed mrbardia72 closed 5 months ago
Yea, that is a good point. I guess the current code base doesn't not have this situation. Your PR does not have this change, so I can't accept that. I will make this change.
I looked at this closer. The error will never be wrapped.
if err := validate.Struct(val); err != nil {
// Use a type assertion to get the real error value.
verrors, ok := err.(validator.ValidationErrors)
if !ok {
return err
}
Notice the error we are evaulating is coming from the validate.Struct
call. This is not an error we are constructing and could be wrapped.
https://github.com/ardanlabs/service/blob/master/foundation/validate/validate.go#L47
Convert to the following code: