commit 32fe2282c4aafcb060ac5d0a5ccfd5a884eced88 parent a1166768149ef9d6c948c73b07190008e3207999 Author: tsmethurst <tobi.smethurst@klarrio.com> Date: Fri, 3 Sep 2021 11:12:19 +0200 review changes Diffstat:
M | internal/validate/structvalidation.go | | | 13 | +------------ |
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/internal/validate/structvalidation.go b/internal/validate/structvalidation.go @@ -27,11 +27,6 @@ import ( var v *validator.Validate -// Validation Panic messages -const ( - InvalidPanic = "validate function was passed invalid item" -) - func ulidValidator(fl validator.FieldLevel) bool { field := fl.Field() @@ -52,13 +47,7 @@ func init() { // Struct validates the passed struct, returning validator.ValidationErrors if invalid, or nil if OK. func Struct(s interface{}) error { - switch reflect.TypeOf(s).Kind() { - case reflect.Invalid: - panic(InvalidPanic) - } - - err := v.Struct(s) - return processValidationError(err) + return processValidationError(v.Struct(s)) } func processValidationError(err error) error {