From ec440d446d4ffebfaf0c4c52c4b0e06edb27cb25 Mon Sep 17 00:00:00 2001 From: Oleg Sidorov Date: Fri, 12 Jul 2019 16:52:15 +0200 Subject: [PATCH] Replaced ghodss/yaml with sigs.k8s.io/yaml This commit replaces usage of github.com/ghodss/yaml with it's forked version maintained by SIG community. The replaced library has low-to-none support activity unlike the latter. We believe the new Helm branch could benefit from using the community-supported version on a long-term run as yaml parser is a key component of Helm chart rendering engine. This commit locks sigs.k8s.io/yaml dependency version on 1.1.0 which is backwards compatible with ghodss/yaml 1.0.0. This change also resolves the outdated dependency version lock for ghodss/yaml (currently 1.0.0) and makes it possible to port changes from https://github.com/helm/helm/pull/6010 to dev-v3. Signed-off-by: Oleg Sidorov --- Gopkg.toml | 4 ++++ cmd/helm/init.go | 2 +- cmd/helm/printer.go | 2 +- pkg/action/get_values.go | 2 +- pkg/action/install.go | 2 +- pkg/action/output.go | 6 +++--- pkg/action/show.go | 2 +- pkg/chart/loader/load.go | 2 +- pkg/chartutil/chartfile.go | 2 +- pkg/chartutil/create.go | 2 +- pkg/chartutil/jsonschema.go | 2 +- pkg/chartutil/save.go | 2 +- pkg/chartutil/values.go | 2 +- pkg/downloader/manager.go | 2 +- pkg/lint/rules/template.go | 2 +- pkg/plugin/plugin.go | 2 +- pkg/provenance/sign.go | 2 +- pkg/releasetesting/test_suite.go | 2 +- pkg/releaseutil/manifest_sorter.go | 2 +- pkg/releaseutil/manifest_sorter_test.go | 2 +- pkg/repo/chartrepo.go | 2 +- pkg/repo/index.go | 2 +- pkg/repo/repo.go | 2 +- pkg/repo/repotest/server.go | 2 +- pkg/repo/repotest/server_test.go | 2 +- pkg/strvals/parser.go | 2 +- pkg/strvals/parser_test.go | 2 +- 27 files changed, 32 insertions(+), 28 deletions(-) diff --git a/Gopkg.toml b/Gopkg.toml index 31f29ff60..8dbc74de6 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -112,3 +112,7 @@ [[constraint]] name = "github.com/spf13/cobra" version = "0.0.4" + +[[constraint]] + name = "sigs.k8s.io/yaml" + version = "1.1.0" diff --git a/cmd/helm/init.go b/cmd/helm/init.go index a3f6e721d..bde922e3a 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -23,9 +23,9 @@ import ( "os" "github.com/Masterminds/semver" - "github.com/ghodss/yaml" "github.com/pkg/errors" "github.com/spf13/cobra" + "sigs.k8s.io/yaml" "helm.sh/helm/cmd/helm/require" "helm.sh/helm/pkg/getter" diff --git a/cmd/helm/printer.go b/cmd/helm/printer.go index 0f2207695..0f89293d4 100644 --- a/cmd/helm/printer.go +++ b/cmd/helm/printer.go @@ -21,7 +21,7 @@ import ( "text/template" "time" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chartutil" "helm.sh/helm/pkg/release" diff --git a/pkg/action/get_values.go b/pkg/action/get_values.go index cf7cabbea..2ba6f54cd 100644 --- a/pkg/action/get_values.go +++ b/pkg/action/get_values.go @@ -17,7 +17,7 @@ limitations under the License. package action import ( - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chartutil" ) diff --git a/pkg/action/install.go b/pkg/action/install.go index 290362ac1..03f90beb4 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -31,8 +31,8 @@ import ( "time" "github.com/Masterminds/sprig" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" "helm.sh/helm/pkg/chartutil" diff --git a/pkg/action/output.go b/pkg/action/output.go index 06fb0d4e1..5346dc109 100644 --- a/pkg/action/output.go +++ b/pkg/action/output.go @@ -1,11 +1,11 @@ package action import ( - "fmt" "encoding/json" + "fmt" - "github.com/ghodss/yaml" "github.com/gosuri/uitable" + "sigs.k8s.io/yaml" ) // OutputFormat is a type for capturing supported output formats @@ -70,4 +70,4 @@ func ParseOutputFormat(s string) (out OutputFormat, err error) { out, err = "", ErrInvalidFormatType } return -} \ No newline at end of file +} diff --git a/pkg/action/show.go b/pkg/action/show.go index fd78dfeb0..7221e93ab 100644 --- a/pkg/action/show.go +++ b/pkg/action/show.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" "helm.sh/helm/pkg/chart/loader" diff --git a/pkg/chart/loader/load.go b/pkg/chart/loader/load.go index 751fb09e5..7308033c9 100644 --- a/pkg/chart/loader/load.go +++ b/pkg/chart/loader/load.go @@ -22,8 +22,8 @@ import ( "path/filepath" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" ) diff --git a/pkg/chartutil/chartfile.go b/pkg/chartutil/chartfile.go index 7deebaa98..4850c2f81 100644 --- a/pkg/chartutil/chartfile.go +++ b/pkg/chartutil/chartfile.go @@ -21,8 +21,8 @@ import ( "os" "path/filepath" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" ) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 3e757b1c3..27a5627e0 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -23,8 +23,8 @@ import ( "path/filepath" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" "helm.sh/helm/pkg/chart/loader" diff --git a/pkg/chartutil/jsonschema.go b/pkg/chartutil/jsonschema.go index b2d704422..fe1aced7c 100644 --- a/pkg/chartutil/jsonschema.go +++ b/pkg/chartutil/jsonschema.go @@ -21,9 +21,9 @@ import ( "fmt" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" "github.com/xeipuuv/gojsonschema" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" ) diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index bde902c98..48cdea5bb 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -24,8 +24,8 @@ import ( "os" "path/filepath" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" ) diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index bdf8a3ff4..f0c4f0236 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -22,8 +22,8 @@ import ( "io/ioutil" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" ) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 422c5b438..3042c21b1 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -27,8 +27,8 @@ import ( "sync" "github.com/Masterminds/semver" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" "helm.sh/helm/pkg/chart/loader" diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index 7bafe1723..db86417dc 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -20,8 +20,8 @@ import ( "os" "path/filepath" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart/loader" "helm.sh/helm/pkg/chartutil" diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index 7b06f47c8..8c8072a27 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -23,7 +23,7 @@ import ( "runtime" "strings" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" helm_env "helm.sh/helm/pkg/cli" ) diff --git a/pkg/provenance/sign.go b/pkg/provenance/sign.go index 7735a5520..469205527 100644 --- a/pkg/provenance/sign.go +++ b/pkg/provenance/sign.go @@ -25,11 +25,11 @@ import ( "path/filepath" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" "golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp/clearsign" "golang.org/x/crypto/openpgp/packet" + "sigs.k8s.io/yaml" hapi "helm.sh/helm/pkg/chart" "helm.sh/helm/pkg/chart/loader" diff --git a/pkg/releasetesting/test_suite.go b/pkg/releasetesting/test_suite.go index 62c6fb157..05500881c 100644 --- a/pkg/releasetesting/test_suite.go +++ b/pkg/releasetesting/test_suite.go @@ -20,9 +20,9 @@ import ( "strings" "time" - "github.com/ghodss/yaml" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/hooks" "helm.sh/helm/pkg/release" diff --git a/pkg/releaseutil/manifest_sorter.go b/pkg/releaseutil/manifest_sorter.go index 41e501c9f..c4e5e255a 100644 --- a/pkg/releaseutil/manifest_sorter.go +++ b/pkg/releaseutil/manifest_sorter.go @@ -22,8 +22,8 @@ import ( "strconv" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chartutil" "helm.sh/helm/pkg/hooks" diff --git a/pkg/releaseutil/manifest_sorter_test.go b/pkg/releaseutil/manifest_sorter_test.go index 580b83137..4fa22a192 100644 --- a/pkg/releaseutil/manifest_sorter_test.go +++ b/pkg/releaseutil/manifest_sorter_test.go @@ -20,7 +20,7 @@ import ( "reflect" "testing" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chartutil" "helm.sh/helm/pkg/release" diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index 0cf5851cb..0dbacfa94 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -24,8 +24,8 @@ import ( "path/filepath" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart/loader" "helm.sh/helm/pkg/getter" diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 4a1e71c8e..eeb7cff74 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -28,8 +28,8 @@ import ( "time" "github.com/Masterminds/semver" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/chart" "helm.sh/helm/pkg/chart/loader" diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index 8bfe0115b..aa6f84e3f 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -22,8 +22,8 @@ import ( "os" "time" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" ) // ErrRepoOutOfDate indicates that the repository file is out of date, but diff --git a/pkg/repo/repotest/server.go b/pkg/repo/repotest/server.go index 72688e63c..5afd67617 100644 --- a/pkg/repo/repotest/server.go +++ b/pkg/repo/repotest/server.go @@ -22,7 +22,7 @@ import ( "os" "path/filepath" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/helmpath" "helm.sh/helm/pkg/repo" diff --git a/pkg/repo/repotest/server_test.go b/pkg/repo/repotest/server_test.go index 0fc33e252..5ecbcbda4 100644 --- a/pkg/repo/repotest/server_test.go +++ b/pkg/repo/repotest/server_test.go @@ -22,7 +22,7 @@ import ( "path/filepath" "testing" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" "helm.sh/helm/pkg/repo" ) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 610f8ad4a..a2f02fdd1 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -21,8 +21,8 @@ import ( "strconv" "strings" - "github.com/ghodss/yaml" "github.com/pkg/errors" + "sigs.k8s.io/yaml" ) // ErrNotList indicates that a non-list was treated as a list. diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index 0a1d5ef58..0bb1562d5 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -18,7 +18,7 @@ package strvals import ( "testing" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" ) func TestSetIndex(t *testing.T) {