validate: allow promotion of int to float64

This commit is contained in:
Alex Crawford 2015-01-14 17:54:01 -08:00
parent 7cfa0df7c4
commit fc77ba6355

View File

@ -107,7 +107,9 @@ func isCompatible(n, g reflect.Kind) bool {
return n == reflect.String || n == reflect.Int || n == reflect.Float64 || n == reflect.Bool return n == reflect.String || n == reflect.Int || n == reflect.Float64 || n == reflect.Bool
case reflect.Struct: case reflect.Struct:
return n == reflect.Struct || n == reflect.Map return n == reflect.Struct || n == reflect.Map
case reflect.Bool, reflect.Slice, reflect.Int, reflect.Float64: case reflect.Float64:
return n == reflect.Float64 || n == reflect.Int
case reflect.Bool, reflect.Slice, reflect.Int:
return n == g return n == g
default: default:
panic(fmt.Sprintf("isCompatible(): unhandled kind %s", g)) panic(fmt.Sprintf("isCompatible(): unhandled kind %s", g))