From 91886a45477f2297750309448d527257721e9b69 Mon Sep 17 00:00:00 2001 From: pylemon Date: Fri, 27 Mar 2015 13:30:59 +0800 Subject: [PATCH] bugfix: if a form field type is bool, valid Required should always return true instead of return its value. --- validation/validators.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validation/validators.go b/validation/validators.go index 25415bdd..725b1f7a 100644 --- a/validation/validators.go +++ b/validation/validators.go @@ -64,8 +64,8 @@ func (r Required) IsSatisfied(obj interface{}) bool { if str, ok := obj.(string); ok { return len(str) > 0 } - if b, ok := obj.(bool); ok { - return b + if _, ok := obj.(bool); ok { + return true } if i, ok := obj.(int); ok { return i != 0