aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authordeepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>2022-03-06 16:34:01 +0800
committerGitHub <noreply@github.com>2022-03-06 16:34:01 +0800
commitb7372b1f32cd0bb40984debfb049e3fc04efaee4 (patch)
tree0cb026c33f4aa452a6b28e344278e1a33399d484 /internal
parent5afca6ca8eaadebc613dce291da2bae1030ccca9 (diff)
autofix: fix unnecessary allocations due to `strings.Index` call (#6806)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/markup/markdown.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/markup/markdown.go b/internal/markup/markdown.go
index f8078b38..ee4e1ab0 100644
--- a/internal/markup/markdown.go
+++ b/internal/markup/markdown.go
@@ -67,8 +67,8 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
m := CommitPattern.Find(link)
if m != nil {
m = bytes.TrimSpace(m)
- i := strings.Index(string(m), "commit/")
- j := strings.Index(string(m), "#")
+ i := bytes.Index(m, []byte("commit/"))
+ j := bytes.Index(m, []byte("#"))
if j == -1 {
j = len(m)
}
@@ -79,8 +79,8 @@ func (r *MarkdownRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
m = IssueFullPattern.Find(link)
if m != nil {
m = bytes.TrimSpace(m)
- i := strings.Index(string(m), "issues/")
- j := strings.Index(string(m), "#")
+ i := bytes.Index(m, []byte("issues/"))
+ j := bytes.Index(m, []byte("#"))
if j == -1 {
j = len(m)
}