mirror of
https://github.com/rancher/os.git
synced 2025-09-28 14:05:03 +00:00
Fix validation tests, update deps and use the rancher/docker version that uses logrus for daemon
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
14
vendor/github.com/xeipuuv/gojsonschema/utils.go
generated
vendored
14
vendor/github.com/xeipuuv/gojsonschema/utils.go
generated
vendored
@@ -34,7 +34,12 @@ import (
|
||||
)
|
||||
|
||||
func isKind(what interface{}, kind reflect.Kind) bool {
|
||||
return reflect.ValueOf(what).Kind() == kind
|
||||
target := what
|
||||
if isJsonNumber(what) {
|
||||
// JSON Numbers are strings!
|
||||
target = *mustBeNumber(what)
|
||||
}
|
||||
return reflect.ValueOf(target).Kind() == kind
|
||||
}
|
||||
|
||||
func existsMapKey(m map[string]interface{}, k string) bool {
|
||||
@@ -77,13 +82,14 @@ func checkJsonNumber(what interface{}) (isValidFloat64 bool, isValidInt64 bool,
|
||||
|
||||
jsonNumber := what.(json.Number)
|
||||
|
||||
_, errFloat64 := jsonNumber.Float64()
|
||||
_, errInt64 := jsonNumber.Int64()
|
||||
f64, errFloat64 := jsonNumber.Float64()
|
||||
s64 := strconv.FormatFloat(f64, 'f', -1, 64)
|
||||
_, errInt64 := strconv.ParseInt(s64, 10, 64)
|
||||
|
||||
isValidFloat64 = errFloat64 == nil
|
||||
isValidInt64 = errInt64 == nil
|
||||
|
||||
_, errInt32 := strconv.ParseInt(jsonNumber.String(), 10, 32)
|
||||
_, errInt32 := strconv.ParseInt(s64, 10, 32)
|
||||
isValidInt32 = isValidInt64 && errInt32 == nil
|
||||
|
||||
return
|
||||
|
Reference in New Issue
Block a user