Skip to content

Commit

Permalink
Use sigs.k8s.io/yaml rather than pkg.in/yaml.v2. (#1438)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcin Owsiany <mowsiany@D2iQ.com>
  • Loading branch information
porridge committed Mar 25, 2020
1 parent dc74924 commit 9515d86
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/gosuri/uitable v0.0.4
github.com/huandu/xstrings v1.2.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/manifoldco/promptui v0.6.0
github.com/mattn/go-colorable v0.1.4 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,6 @@ github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46O
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU=
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
Expand Down
7 changes: 5 additions & 2 deletions pkg/kudoctl/cmd/params/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"strings"

"github.com/spf13/afero"
"gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/kudobuilder/kudo/pkg/apis/kudo/v1beta1"
"github.com/kudobuilder/kudo/pkg/kudoctl/clog"
"github.com/kudobuilder/kudo/pkg/util/convert"
)

Expand Down Expand Up @@ -51,12 +52,14 @@ func getParamsFromFiles(fs afero.Fs, filePaths []string, errs []string) (map[str
continue
}
data := make(map[string]interface{})
err = yaml.Unmarshal(rawData, data)
err = yaml.Unmarshal(rawData, &data)
if err != nil {
errs = append(errs, fmt.Sprintf("error unmarshalling content of parameter file %s: %v", filePath, err))
continue
}
clog.V(2).Printf("Unmarshalling %q...", filePath)
for key, value := range data {
clog.V(3).Printf("Value of parameter %q is a %T: %v", key, value, value)
var valueType v1beta1.ParameterType
switch value.(type) {
case map[string]interface{}:
Expand Down
12 changes: 12 additions & 0 deletions pkg/kudoctl/cmd/params/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ func TestGetParameterMap(t *testing.T) {
"error reading from parameter file missing-file: open missing-file: file does not exist",
nil,
},
{
"regression test for #1437",
nil,
[]string{"param-file"},
map[string]string{
"param-file": "A:\n- foo: bar\n",
},
"",
map[string]string{
"A": "- foo: bar\n",
},
},
}
for _, test := range tests {
test := test
Expand Down

0 comments on commit 9515d86

Please sign in to comment.