diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-21 15:35:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-21 15:35:07 +0200 |
commit | e9b344266a563a3dfcf693fc817f6b8cc0b7d815 (patch) | |
tree | fc8340f9631702ac0b1721c1e5d9478c0d78c971 /vendor | |
parent | a594de2cf457a1a5e5fecd8329853e9ec19c5582 (diff) | |
parent | 2bdb8f1804a125c8f95c8c4aa859225589aad7de (diff) | |
download | podman-e9b344266a563a3dfcf693fc817f6b8cc0b7d815.tar.gz podman-e9b344266a563a3dfcf693fc817f6b8cc0b7d815.tar.bz2 podman-e9b344266a563a3dfcf693fc817f6b8cc0b7d815.zip |
Merge pull request #6315 from containers/dependabot/go_modules/k8s.io/api-0.18.3
Bump k8s.io/api from 0.18.2 to 0.18.3
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/k8s.io/apimachinery/pkg/util/json/json.go | 25 | ||||
-rw-r--r-- | vendor/modules.txt | 4 |
2 files changed, 27 insertions, 2 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/util/json/json.go b/vendor/k8s.io/apimachinery/pkg/util/json/json.go index 0e2e30175..204834883 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/json/json.go +++ b/vendor/k8s.io/apimachinery/pkg/util/json/json.go @@ -66,11 +66,36 @@ func Unmarshal(data []byte, v interface{}) error { // If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64 return convertSliceNumbers(*v, 0) + case *interface{}: + // Build a decoder from the given data + decoder := json.NewDecoder(bytes.NewBuffer(data)) + // Preserve numbers, rather than casting to float64 automatically + decoder.UseNumber() + // Run the decode + if err := decoder.Decode(v); err != nil { + return err + } + // If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64 + return convertInterfaceNumbers(v, 0) + default: return json.Unmarshal(data, v) } } +func convertInterfaceNumbers(v *interface{}, depth int) error { + var err error + switch v2 := (*v).(type) { + case json.Number: + *v, err = convertNumber(v2) + case map[string]interface{}: + err = convertMapNumbers(v2, depth+1) + case []interface{}: + err = convertSliceNumbers(v2, depth+1) + } + return err +} + // convertMapNumbers traverses the map, converting any json.Number values to int64 or float64. // values which are map[string]interface{} or []interface{} are recursively visited func convertMapNumbers(m map[string]interface{}, depth int) error { diff --git a/vendor/modules.txt b/vendor/modules.txt index 2e8976d47..d82137dac 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -681,9 +681,9 @@ gopkg.in/square/go-jose.v2/json gopkg.in/tomb.v1 # gopkg.in/yaml.v2 v2.3.0 gopkg.in/yaml.v2 -# k8s.io/api v0.18.2 +# k8s.io/api v0.18.3 k8s.io/api/core/v1 -# k8s.io/apimachinery v0.18.2 +# k8s.io/apimachinery v0.18.3 k8s.io/apimachinery/pkg/api/errors k8s.io/apimachinery/pkg/api/resource k8s.io/apimachinery/pkg/apis/meta/v1 |