bump: upgrade gopkg.in/yaml.v2 to gopkg.in/yaml.v3

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2022-10-03 05:24:51 +08:00
parent 2a7669f8fa
commit 14ba7cd156
19 changed files with 106 additions and 52 deletions
+3 -2
View File
@@ -13,11 +13,12 @@ import (
"strings"
"text/template"
"github.com/ghodss/yaml"
"golang.org/x/sync/errgroup"
"gopkg.in/yaml.v3"
"github.com/helmfile/helmfile/pkg/envvar"
"github.com/helmfile/helmfile/pkg/helmexec"
"github.com/helmfile/helmfile/pkg/maputil"
)
type Values = map[string]interface{}
@@ -278,7 +279,7 @@ func (c *Context) Tpl(text string, data interface{}) (string, error) {
}
func ToYaml(v interface{}) (string, error) {
data, err := yaml.Marshal(v)
data, err := maputil.YamlMarshal(v)
if err != nil {
return "", err
}
+2 -2
View File
@@ -178,7 +178,7 @@ func TestReadFile_PassAbsPath(t *testing.T) {
}
func TestToYaml_UnsupportedNestedMapKey(t *testing.T) {
expected := ``
expected := "foo:\n bar: BAR\n"
// nolint: unconvert
vals := Values(map[string]interface{}{
"foo": map[interface{}]interface{}{
@@ -186,8 +186,8 @@ func TestToYaml_UnsupportedNestedMapKey(t *testing.T) {
},
})
actual, err := ToYaml(vals)
require.Error(t, err, "error marshaling into JSON: json: unsupported type: map[interface {}]interface {}")
require.Equal(t, expected, actual)
require.NoError(t, err, "expected nil, but got: %v, when type: map[interface {}]interface {}", err)
}
func TestToYaml(t *testing.T) {