mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-07 14:15:41 +02:00
bump: upgrade gopkg.in/yaml.v2 to gopkg.in/yaml.v3
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user