Why does RegisterValidation return error?
Package version eg. v8, v9:
9.3.6
Issue, Question or Enhancement:
Why does the RegisterValidation function return error? Looking at the implementation, errors only occur if the caller provides empty arguments. On the other hand, if the caller provides a tag with invalid characters, the function panics instead of returning an error. This seems inconsistent, both within this function and with the other Register functions, most of which do not return errors.
I noticed this because I'm using errcheck with my project and had to add ignore rules for these function calls.
I see what you mean, it should panic if any issue; because if any validation fails to register there's a failure point, especially if an error is ignored.
I think it must have been some legacy code hanging around.
I unfortunately can't change v9 for compatibility reasons but will change as an enhancement for V10 some day :)
Thanks for bringing to my attention.
@deankarn Is this still desired? If so, I can look into making a PR for it.
Whoops, tried to add it to v11 milestone but don't yet have the permissions to create that :)