From 9301948b33616a06bebac1c58dcf93d5d1fdfa7d Mon Sep 17 00:00:00 2001 From: wutongjie23hao Date: Mon, 27 May 2019 19:18:35 +0800 Subject: [PATCH] replace ReplaceAll to Replace Signed-off-by: wutongjie23hao --- pkg/chart/loader/archive.go | 2 +- pkg/chartutil/create.go | 2 +- pkg/engine/engine.go | 4 ++-- pkg/kube/client.go | 2 +- pkg/plugin/cache/cache.go | 4 ++-- pkg/registry/cache.go | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/chart/loader/archive.go b/pkg/chart/loader/archive.go index a8dc3f17b..514f2e1bb 100644 --- a/pkg/chart/loader/archive.go +++ b/pkg/chart/loader/archive.go @@ -90,7 +90,7 @@ func LoadArchive(in io.Reader) (*chart.Chart, error) { n := strings.Join(parts[1:], delimiter) // Normalize the path to the / delimiter - n = strings.ReplaceAll(n, delimiter, "/") + n = strings.Replace(n, delimiter, "/", -1) if parts[0] == "Chart.yaml" { return nil, errors.New("chart yaml not in base directory") diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 01b7fb43b..ff6d039e7 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -452,5 +452,5 @@ func Create(name, dir string) (string, error) { // transform performs a string replacement of the specified source for // a given key with the replacement string func transform(src, replacement string) []byte { - return []byte(strings.ReplaceAll(src, "", replacement)) + return []byte(strings.Replace(src, "", replacement, -1)) } diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 4d3e418bc..5a3654f4a 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -187,8 +187,8 @@ func (e Engine) renderWithReferences(tpls, referenceTpls map[string]renderable) // is set. Since missing=error will never get here, we do not need to handle // the Strict case. f := &chart.File{ - Name: strings.ReplaceAll(filename, "/templates", "/manifests"), - Data: []byte(strings.ReplaceAll(buf.String(), "", "")), + Name: strings.Replace(filename, "/templates", "/manifests", -1), + Data: []byte(strings.Replace(buf.String(), "", "", -1)), } rendered[filename] = string(f.Data) } diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 8df24bef5..de3bc5c04 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -484,7 +484,7 @@ func scrubValidationError(err error) error { const stopValidateMessage = "if you choose to ignore these errors, turn validation off with --validate=false" if strings.Contains(err.Error(), stopValidateMessage) { - return errors.New(strings.ReplaceAll(err.Error(), "; "+stopValidateMessage, "")) + return errors.New(strings.Replace(err.Error(), "; "+stopValidateMessage, "", -1)) } return err } diff --git a/pkg/plugin/cache/cache.go b/pkg/plugin/cache/cache.go index 72c0b7061..70a7cd20e 100644 --- a/pkg/plugin/cache/cache.go +++ b/pkg/plugin/cache/cache.go @@ -65,10 +65,10 @@ func Key(repo string) (string, error) { } key = key + u.Host if u.Path != "" { - key = key + strings.ReplaceAll(u.Path, "/", "-") + key = key + strings.Replace(u.Path, "/", "-", -1) } - key = strings.ReplaceAll(key, ":", "-") + key = strings.Replace(key, ":", "-", -1) return key, nil } diff --git a/pkg/registry/cache.go b/pkg/registry/cache.go index ccedd1e54..c4af7105c 100644 --- a/pkg/registry/cache.go +++ b/pkg/registry/cache.go @@ -258,12 +258,12 @@ func (cache *filesystemCache) TableRows() ([][]interface{}, error) { // escape sanitizes a registry URL to remove characters such as ":" // which are illegal on windows func escape(s string) string { - return strings.ReplaceAll(s, ":", "_") + return strings.Replace(s, ":", "_", -1) } // escape reverses escape func unescape(s string) string { - return strings.ReplaceAll(s, "_", ":") + return strings.Replace(s, "_", ":", -1) } // printChartSummary prints details about a chart layers