Skip to content

Commit b9f777d

Browse files
committed
fix QF1004: could use strings.ReplaceAll instead
1 parent dca762a commit b9f777d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

images/builder/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func runSingleJob(o options, jobName, uploaded, version string, subs map[string]
214214

215215
var logFilePath string
216216
if o.logDir != "" {
217-
logFilePath = path.Join(o.logDir, strings.Replace(jobName, "/", "-", -1)+".log")
217+
logFilePath = path.Join(o.logDir, strings.ReplaceAll(jobName, "/", "-")+".log")
218218
f, err := os.Create(logFilePath)
219219

220220
if err != nil {

kubetest/aksengine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (c *aksEngineDeployer) SetCustomCloudProfileEnvironment() error {
204204
if c.isAzureStackCloud() {
205205
env := azure.Environment{}
206206
env.Name = c.azureEnvironment
207-
azsFQDNSuffix := strings.Replace(c.azureCustomCloudURL, fmt.Sprintf("https://portal.%s.", c.location), "", -1)
207+
azsFQDNSuffix := strings.ReplaceAll(c.azureCustomCloudURL, fmt.Sprintf("https://portal.%s.", c.location), "")
208208
azsFQDNSuffix = strings.TrimSuffix(azsFQDNSuffix, "/")
209209
env.ResourceManagerEndpoint = fmt.Sprintf("https://management.%s.%s/", c.location, azsFQDNSuffix)
210210
metadataURL := fmt.Sprintf("%s/metadata/endpoints?api-version=1.0", strings.TrimSuffix(env.ResourceManagerEndpoint, "/"))

label_sync/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func writeTemplate(templatePath string, outputPath string, data interface{}) err
190190
// set up template
191191
funcMap := template.FuncMap{
192192
"anchor": func(input string) string {
193-
return strings.Replace(input, ":", " ", -1)
193+
return strings.ReplaceAll(input, ":", " ")
194194
},
195195
}
196196
t, err := template.New(filepath.Base(templatePath)).Funcs(funcMap).ParseFiles(templatePath)
@@ -930,7 +930,7 @@ func writeDocs(template string, output string, config Configuration) error {
930930
// I could not find a proper doc, so rules here a mostly empirical
931931
func linkify(text string) string {
932932
// swap space with dash
933-
link := strings.Replace(text, " ", "-", -1)
933+
link := strings.ReplaceAll(text, " ", "-")
934934
// discard some special characters
935935
discard, _ := regexp.Compile("[,/]")
936936
link = discard.ReplaceAllString(link, "")

0 commit comments

Comments
 (0)