replace ReplaceAll to Replace

Signed-off-by: wutongjie23hao <xiaolei.liang@qq.com>
pull/5802/head
wutongjie23hao 6 years ago
parent b9a54967f8
commit 9301948b33

@ -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")

@ -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, "<CHARTNAME>", replacement))
return []byte(strings.Replace(src, "<CHARTNAME>", replacement, -1))
}

@ -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(), "<no value>", "")),
Name: strings.Replace(filename, "/templates", "/manifests", -1),
Data: []byte(strings.Replace(buf.String(), "<no value>", "", -1)),
}
rendered[filename] = string(f.Data)
}

@ -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
}

@ -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
}

@ -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

Loading…
Cancel
Save