all: Use ReplaceAll instead of Replace with -1 pos
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>dependabot/go_modules/go.uber.org/atomic-1.10.0
parent
ca8baeb308
commit
855aa4f7a7
|
@ -96,8 +96,8 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func escape(s string) string {
|
||||
escaped := strings.Replace(s, "\n", " ", -1)
|
||||
escaped = strings.Replace(escaped, "\r", " ", -1)
|
||||
escaped := strings.ReplaceAll(s, "\n", " ")
|
||||
escaped = strings.ReplaceAll(escaped, "\r", " ")
|
||||
return escaped
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ GLOBAL OPTIONS:
|
|||
{{end}}
|
||||
`[1:]
|
||||
|
||||
commandUsageTemplate = template.Must(template.New("command_usage").Funcs(templFuncs).Parse(strings.Replace(commandUsage, "\\\n", "", -1)))
|
||||
commandUsageTemplate = template.Must(template.New("command_usage").Funcs(templFuncs).Parse(strings.ReplaceAll(commandUsage, "\\\n", "")))
|
||||
}
|
||||
|
||||
func etcdFlagUsages(flagSet *pflag.FlagSet) string {
|
||||
|
|
|
@ -66,7 +66,7 @@ func SetPflagsFromEnv(lg *zap.Logger, prefix string, fs *pflag.FlagSet) error {
|
|||
|
||||
// FlagToEnv converts flag string to upper-case environment variable key string.
|
||||
func FlagToEnv(prefix, name string) string {
|
||||
return prefix + "_" + strings.ToUpper(strings.Replace(name, "-", "_", -1))
|
||||
return prefix + "_" + strings.ToUpper(strings.ReplaceAll(name, "-", "_"))
|
||||
}
|
||||
|
||||
func verifyEnv(lg *zap.Logger, prefix string, usedEnvKey, alreadySet map[string]bool) {
|
||||
|
|
|
@ -106,7 +106,7 @@ func TestAuthority(t *testing.T) {
|
|||
}
|
||||
|
||||
testutils.ExecuteWithTimeout(t, 5*time.Second, func() {
|
||||
assertAuthority(t, strings.Replace(tc.expectAuthorityPattern, "${MEMBER_PORT}", "20000", -1), epc)
|
||||
assertAuthority(t, strings.ReplaceAll(tc.expectAuthorityPattern, "${MEMBER_PORT}", "20000"), epc)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -119,7 +119,7 @@ func templateEndpoints(t *testing.T, pattern string, clus *e2e.EtcdProcessCluste
|
|||
var endpoints []string
|
||||
for i := 0; i < clus.Cfg.ClusterSize; i++ {
|
||||
ent := pattern
|
||||
ent = strings.Replace(ent, "${MEMBER_PORT}", fmt.Sprintf("%d", e2e.EtcdProcessBasePort+i*5), -1)
|
||||
ent = strings.ReplaceAll(ent, "${MEMBER_PORT}", fmt.Sprintf("%d", e2e.EtcdProcessBasePort+i*5))
|
||||
endpoints = append(endpoints, ent)
|
||||
}
|
||||
return endpoints
|
||||
|
|
|
@ -101,7 +101,7 @@ GLOBAL OPTIONS:
|
|||
{{end}}
|
||||
`[1:]
|
||||
|
||||
commandUsageTemplate = template.Must(template.New("command_usage").Funcs(templFuncs).Parse(strings.Replace(commandUsage, "\\\n", "", -1)))
|
||||
commandUsageTemplate = template.Must(template.New("command_usage").Funcs(templFuncs).Parse(strings.ReplaceAll(commandUsage, "\\\n", "")))
|
||||
}
|
||||
|
||||
func etcdFlagUsages(flagSet *pflag.FlagSet) string {
|
||||
|
|
|
@ -146,8 +146,8 @@ func templateEndpoints(t *testing.T, pattern string, clus *integration.Cluster)
|
|||
var endpoints []string
|
||||
for _, m := range clus.Members {
|
||||
ent := pattern
|
||||
ent = strings.Replace(ent, "${MEMBER_PORT}", m.GrpcPortNumber(), -1)
|
||||
ent = strings.Replace(ent, "${MEMBER_NAME}", m.Name, -1)
|
||||
ent = strings.ReplaceAll(ent, "${MEMBER_PORT}", m.GrpcPortNumber())
|
||||
ent = strings.ReplaceAll(ent, "${MEMBER_NAME}", m.Name)
|
||||
endpoints = append(endpoints, ent)
|
||||
}
|
||||
return endpoints
|
||||
|
@ -156,8 +156,8 @@ func templateEndpoints(t *testing.T, pattern string, clus *integration.Cluster)
|
|||
func templateAuthority(t *testing.T, pattern string, m *integration.Member) string {
|
||||
t.Helper()
|
||||
authority := pattern
|
||||
authority = strings.Replace(authority, "${MEMBER_PORT}", m.GrpcPortNumber(), -1)
|
||||
authority = strings.Replace(authority, "${MEMBER_NAME}", m.Name, -1)
|
||||
authority = strings.ReplaceAll(authority, "${MEMBER_PORT}", m.GrpcPortNumber())
|
||||
authority = strings.ReplaceAll(authority, "${MEMBER_NAME}", m.Name)
|
||||
return authority
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ func persistMemberDataDir(t *testing.T, clus *e2e.EtcdProcessCluster, path strin
|
|||
}
|
||||
|
||||
func testResultsDirectory(t *testing.T) (string, error) {
|
||||
path, err := filepath.Abs(filepath.Join(resultsDirectory, strings.Replace(t.Name(), "/", "_", -1)))
|
||||
path, err := filepath.Abs(filepath.Join(resultsDirectory, strings.ReplaceAll(t.Name(), "/", "_")))
|
||||
if err != nil {
|
||||
return path, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue