all: replace strings.Replace with strings.ReplaceAll

This was an addition to Go 1.13 and results in slightly easier to read
code.
This commit is contained in:
Ayke van Laethem
2021-03-04 21:39:09 +01:00
committed by Ron Evans
parent b0366743cd
commit e3aa13c2a6
4 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -266,7 +266,7 @@ func Flash(pkgName, port string, options *compileopts.Options) error {
// Create the command.
flashCmd := config.Target.FlashCommand
fileToken := "{" + fileExt[1:] + "}"
flashCmd = strings.Replace(flashCmd, fileToken, result.Binary, -1)
flashCmd = strings.ReplaceAll(flashCmd, fileToken, result.Binary)
if port == "" && strings.Contains(flashCmd, "{port}") {
var err error
@@ -276,7 +276,7 @@ func Flash(pkgName, port string, options *compileopts.Options) error {
}
}
flashCmd = strings.Replace(flashCmd, "{port}", port, -1)
flashCmd = strings.ReplaceAll(flashCmd, "{port}", port)
// Execute the command.
var cmd *exec.Cmd