summaryrefslogtreecommitdiff
path: root/vendor/sigs.k8s.io/yaml
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2020-05-05 08:57:17 +0000
committerDaniel J Walsh <dwalsh@redhat.com>2020-05-05 13:35:55 -0400
commit2f0bc5ff1cde9afb595868b92dd123478af9ef74 (patch)
treed620dce86657a325eb82b251f95e9cd4903ca80f /vendor/sigs.k8s.io/yaml
parente1be837a4ff149e00ff6af9e71cf9ea625e33e6f (diff)
downloadpodman-2f0bc5ff1cde9afb595868b92dd123478af9ef74.tar.gz
podman-2f0bc5ff1cde9afb595868b92dd123478af9ef74.tar.bz2
podman-2f0bc5ff1cde9afb595868b92dd123478af9ef74.zip
Bump k8s.io/api from 0.17.4 to 0.18.2
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.17.4 to 0.18.2. - [Release notes](https://github.com/kubernetes/api/releases) - [Commits](https://github.com/kubernetes/api/compare/v0.17.4...v0.18.2) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/sigs.k8s.io/yaml')
-rw-r--r--vendor/sigs.k8s.io/yaml/.travis.yml15
-rw-r--r--vendor/sigs.k8s.io/yaml/OWNERS2
-rw-r--r--vendor/sigs.k8s.io/yaml/README.md14
-rw-r--r--vendor/sigs.k8s.io/yaml/go.mod8
-rw-r--r--vendor/sigs.k8s.io/yaml/go.sum9
-rw-r--r--vendor/sigs.k8s.io/yaml/yaml.go61
6 files changed, 95 insertions, 14 deletions
diff --git a/vendor/sigs.k8s.io/yaml/.travis.yml b/vendor/sigs.k8s.io/yaml/.travis.yml
index 03ddc7318..d20e23eff 100644
--- a/vendor/sigs.k8s.io/yaml/.travis.yml
+++ b/vendor/sigs.k8s.io/yaml/.travis.yml
@@ -1,14 +1,13 @@
language: go
dist: xenial
go:
- - 1.9.x
- - 1.10.x
- - 1.11.x
+ - 1.12.x
+ - 1.13.x
script:
- - go get -t -v ./...
- - diff -u <(echo -n) <(gofmt -d .)
+ - diff -u <(echo -n) <(gofmt -d *.go)
- diff -u <(echo -n) <(golint $(go list -e ./...) | grep -v YAMLToJSON)
- - go tool vet .
- - go test -v -race ./...
+ - GO111MODULE=on go vet .
+ - GO111MODULE=on go test -v -race ./...
+ - git diff --exit-code
install:
- - go get golang.org/x/lint/golint
+ - GO111MODULE=off go get golang.org/x/lint/golint
diff --git a/vendor/sigs.k8s.io/yaml/OWNERS b/vendor/sigs.k8s.io/yaml/OWNERS
index 11ad7ce1a..325b40b07 100644
--- a/vendor/sigs.k8s.io/yaml/OWNERS
+++ b/vendor/sigs.k8s.io/yaml/OWNERS
@@ -1,3 +1,5 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
approvers:
- dims
- lavalamp
diff --git a/vendor/sigs.k8s.io/yaml/README.md b/vendor/sigs.k8s.io/yaml/README.md
index 0200f75b4..5a651d916 100644
--- a/vendor/sigs.k8s.io/yaml/README.md
+++ b/vendor/sigs.k8s.io/yaml/README.md
@@ -1,12 +1,14 @@
# YAML marshaling and unmarshaling support for Go
-[![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml)
+[![Build Status](https://travis-ci.org/kubernetes-sigs/yaml.svg)](https://travis-ci.org/kubernetes-sigs/yaml)
+
+kubernetes-sigs/yaml is a permanent fork of [ghodss/yaml](https://github.com/ghodss/yaml).
## Introduction
A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs.
-In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/).
+In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://web.archive.org/web/20190603050330/http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/).
## Compatibility
@@ -32,13 +34,13 @@ GOOD:
To install, run:
```
-$ go get github.com/ghodss/yaml
+$ go get sigs.k8s.io/yaml
```
And import using:
```
-import "github.com/ghodss/yaml"
+import "sigs.k8s.io/yaml"
```
Usage is very similar to the JSON library:
@@ -49,7 +51,7 @@ package main
import (
"fmt"
- "github.com/ghodss/yaml"
+ "sigs.k8s.io/yaml"
)
type Person struct {
@@ -93,7 +95,7 @@ package main
import (
"fmt"
- "github.com/ghodss/yaml"
+ "sigs.k8s.io/yaml"
)
func main() {
diff --git a/vendor/sigs.k8s.io/yaml/go.mod b/vendor/sigs.k8s.io/yaml/go.mod
new file mode 100644
index 000000000..7224f3497
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/go.mod
@@ -0,0 +1,8 @@
+module sigs.k8s.io/yaml
+
+go 1.12
+
+require (
+ github.com/davecgh/go-spew v1.1.1
+ gopkg.in/yaml.v2 v2.2.8
+)
diff --git a/vendor/sigs.k8s.io/yaml/go.sum b/vendor/sigs.k8s.io/yaml/go.sum
new file mode 100644
index 000000000..76e49483a
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/go.sum
@@ -0,0 +1,9 @@
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
+gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/vendor/sigs.k8s.io/yaml/yaml.go b/vendor/sigs.k8s.io/yaml/yaml.go
index 024596112..efbc535d4 100644
--- a/vendor/sigs.k8s.io/yaml/yaml.go
+++ b/vendor/sigs.k8s.io/yaml/yaml.go
@@ -317,3 +317,64 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in
return yamlObj, nil
}
}
+
+// JSONObjectToYAMLObject converts an in-memory JSON object into a YAML in-memory MapSlice,
+// without going through a byte representation. A nil or empty map[string]interface{} input is
+// converted to an empty map, i.e. yaml.MapSlice(nil).
+//
+// interface{} slices stay interface{} slices. map[string]interface{} becomes yaml.MapSlice.
+//
+// int64 and float64 are down casted following the logic of github.com/go-yaml/yaml:
+// - float64s are down-casted as far as possible without data-loss to int, int64, uint64.
+// - int64s are down-casted to int if possible without data-loss.
+//
+// Big int/int64/uint64 do not lose precision as in the json-yaml roundtripping case.
+//
+// string, bool and any other types are unchanged.
+func JSONObjectToYAMLObject(j map[string]interface{}) yaml.MapSlice {
+ if len(j) == 0 {
+ return nil
+ }
+ ret := make(yaml.MapSlice, 0, len(j))
+ for k, v := range j {
+ ret = append(ret, yaml.MapItem{Key: k, Value: jsonToYAMLValue(v)})
+ }
+ return ret
+}
+
+func jsonToYAMLValue(j interface{}) interface{} {
+ switch j := j.(type) {
+ case map[string]interface{}:
+ if j == nil {
+ return interface{}(nil)
+ }
+ return JSONObjectToYAMLObject(j)
+ case []interface{}:
+ if j == nil {
+ return interface{}(nil)
+ }
+ ret := make([]interface{}, len(j))
+ for i := range j {
+ ret[i] = jsonToYAMLValue(j[i])
+ }
+ return ret
+ case float64:
+ // replicate the logic in https://github.com/go-yaml/yaml/blob/51d6538a90f86fe93ac480b35f37b2be17fef232/resolve.go#L151
+ if i64 := int64(j); j == float64(i64) {
+ if i := int(i64); i64 == int64(i) {
+ return i
+ }
+ return i64
+ }
+ if ui64 := uint64(j); j == float64(ui64) {
+ return ui64
+ }
+ return j
+ case int64:
+ if i := int(j); j == int64(i) {
+ return i
+ }
+ return j
+ }
+ return j
+}