From 5afca6ca8eaadebc613dce291da2bae1030ccca9 Mon Sep 17 00:00:00 2001
From: "deepsource-autofix[bot]"
<62050782+deepsource-autofix[bot]@users.noreply.github.com>
Date: Sun, 6 Mar 2022 16:33:55 +0800
Subject: autofix: function call can be replaced with helper function (#6805)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
---
internal/markup/markup.go | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
(limited to 'internal/markup')
diff --git a/internal/markup/markup.go b/internal/markup/markup.go
index fbcab4f3..5aa14a9b 100644
--- a/internal/markup/markup.go
+++ b/internal/markup/markup.go
@@ -155,8 +155,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]strin
ms := MentionPattern.FindAll(rawBytes, -1)
for _, m := range ms {
m = m[bytes.Index(m, []byte("@")):]
- rawBytes = bytes.Replace(rawBytes, m,
- []byte(fmt.Sprintf(`%s`, conf.Server.Subpath, m[1:], m)), -1)
+ rawBytes = bytes.ReplaceAll(rawBytes, m, []byte(fmt.Sprintf(`%s`, conf.Server.Subpath, m[1:], m)))
}
rawBytes = RenderIssueIndexPattern(rawBytes, urlPrefix, metas)
@@ -216,7 +215,7 @@ func wrapImgWithLink(urlPrefix string, buf *bytes.Buffer, token html.Token) {
buf.WriteString(`">`)
if needPrepend {
- src = strings.Replace(urlPrefix+src, " ", "%20", -1)
+ src = strings.ReplaceAll(urlPrefix+src, " ", "%20")
buf.WriteString(`
buf.WriteString(src)
buf.WriteString(`)