diff --git a/issues_test.go b/issues_test.go index d834e6b..aa22748 100644 --- a/issues_test.go +++ b/issues_test.go @@ -177,7 +177,7 @@ func TestIssues34(t *testing.T) { dump.Println(Enum(s1, []int{1, 2, 3, 4}), Enum(int32(s1), []int{1, 2, 3, 4})) - assert.True(t,v.Validate()) + assert.True(t, v.Validate()) dump.Println(v.Errors) type someMode string @@ -188,7 +188,7 @@ func TestIssues34(t *testing.T) { v.StringRules(MS{ "mode": "required|in:abc,def", }) - assert.True(t,v.Validate()) + assert.True(t, v.Validate()) dump.Println(v.Errors) } diff --git a/register.go b/register.go index 4f42ebb..8b166be 100644 --- a/register.go +++ b/register.go @@ -209,7 +209,7 @@ var validatorAliases = map[string]string{ "strint": "isIntString", "strInt": "isIntString", "str_int": "isIntString", - "intstr": "isIntString", + "intstr": "isIntString", "intString": "isIntString", "int_string": "isIntString", // --- diff --git a/validators.go b/validators.go index 466cd70..b8ad114 100644 --- a/validators.go +++ b/validators.go @@ -1099,16 +1099,16 @@ func Between(val interface{}, min, max int64) bool { *************************************************************/ // convert custom type to int or string or unit -func convert(val interface{})(value interface{},err error) { +func convert(val interface{}) (value interface{}, err error) { v := reflect.ValueOf(val) switch v.Kind() { case reflect.String: value = v.String() - case reflect.Int,reflect.Int8,reflect.Int16,reflect.Int32,reflect.Int64: + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: value = v.Int() - case reflect.Uint,reflect.Uint8,reflect.Uint16,reflect.Uint32,reflect.Uint64: + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: value = v.Uint() default: err = errConvertFail @@ -1123,7 +1123,7 @@ func Enum(val, enum interface{}) bool { return false } - v,err := convert(val) + v, err := convert(val) if err != nil { return false }