diff options
author | dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> | 2020-05-21 09:07:42 +0000 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-05-21 07:36:12 -0400 |
commit | 2bdb8f1804a125c8f95c8c4aa859225589aad7de (patch) | |
tree | e599a364004903507f5edb13ac78f45414d4c4ae /vendor/k8s.io/apimachinery | |
parent | 8db7b9ea219ef06c50919dcfabdfdca5676e1456 (diff) | |
download | podman-2bdb8f1804a125c8f95c8c4aa859225589aad7de.tar.gz podman-2bdb8f1804a125c8f95c8c4aa859225589aad7de.tar.bz2 podman-2bdb8f1804a125c8f95c8c4aa859225589aad7de.zip |
Bump k8s.io/api from 0.18.2 to 0.18.3
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.18.2 to 0.18.3.
- [Release notes](https://github.com/kubernetes/api/releases)
- [Commits](https://github.com/kubernetes/api/compare/v0.18.2...v0.18.3)
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/k8s.io/apimachinery')
-rw-r--r-- | vendor/k8s.io/apimachinery/pkg/util/json/json.go | 25 |
1 files changed, 25 insertions, 0 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 { |