diff options
Diffstat (limited to 'pkg/email')
| -rw-r--r-- | pkg/email/parser.go | 4 | ||||
| -rw-r--r-- | pkg/email/parser_test.go | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pkg/email/parser.go b/pkg/email/parser.go index 3ebd7ac08..6db3d2415 100644 --- a/pkg/email/parser.go +++ b/pkg/email/parser.go @@ -368,9 +368,9 @@ func extractArgsTokens(body string, num int) string { if lineEnd == -1 { lineEnd = len(body) - pos } - line := strings.TrimSpace(strings.Replace(body[pos:pos+lineEnd], "\t", " ", -1)) + line := strings.TrimSpace(strings.ReplaceAll(body[pos:pos+lineEnd], "\t", " ")) for { - line1 := strings.Replace(line, " ", " ", -1) + line1 := strings.ReplaceAll(line, " ", " ") if line == line1 { break } diff --git a/pkg/email/parser_test.go b/pkg/email/parser_test.go index 87f6ec38e..c9e7022ae 100644 --- a/pkg/email/parser_test.go +++ b/pkg/email/parser_test.go @@ -19,7 +19,7 @@ func TestExtractCommand(t *testing.T) { if diff := cmp.Diff(test.cmd, cmd); diff != "" { t.Fatal(diff) } - cmd, _ = extractCommand(strings.Replace(test.body, "\n", "\r\n", -1)) + cmd, _ = extractCommand(strings.ReplaceAll(test.body, "\n", "\r\n")) if diff := cmp.Diff(test.cmd, cmd); diff != "" { t.Fatal(diff) } @@ -130,8 +130,8 @@ func TestParse(t *testing.T) { } t.Run(fmt.Sprint(i), func(t *testing.T) { body(t, test) }) - test.email = strings.Replace(test.email, "\n", "\r\n", -1) - test.res.Body = strings.Replace(test.res.Body, "\n", "\r\n", -1) + test.email = strings.ReplaceAll(test.email, "\n", "\r\n") + test.res.Body = strings.ReplaceAll(test.res.Body, "\n", "\r\n") t.Run(fmt.Sprint(i)+"rn", func(t *testing.T) { body(t, test) }) } } |
