From fa0cf899342180fa025a02b82ed4ae8b9cbe91c8 Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Thu, 17 Dec 2020 10:30:44 -0600 Subject: [PATCH] Remove unnecessary buffer Remove buf, which appears to be created and appended to but never used for anything. Found with staticcheck check SA4010 ("The result of append will never be observed anywhere"). --- parser/link.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/parser/link.go b/parser/link.go index e7c6966..de2fcaa 100644 --- a/parser/link.go +++ b/parser/link.go @@ -293,20 +293,17 @@ func (s *linkParser) parseLink(parent ast.Node, last *linkLabelState, block text func parseLinkDestination(block text.Reader) ([]byte, bool) { block.SkipSpaces() line, _ := block.PeekLine() - buf := []byte{} if block.Peek() == '<' { i := 1 for i < len(line) { c := line[i] if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) { - buf = append(buf, '\\', line[i+1]) i += 2 continue } else if c == '>' { block.Advance(i + 1) return line[1:i], true } - buf = append(buf, c) i++ } return nil, false @@ -316,7 +313,6 @@ func parseLinkDestination(block text.Reader) ([]byte, bool) { for i < len(line) { c := line[i] if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) { - buf = append(buf, '\\', line[i+1]) i += 2 continue } else if c == '(' { @@ -329,7 +325,6 @@ func parseLinkDestination(block text.Reader) ([]byte, bool) { } else if util.IsSpace(c) { break } - buf = append(buf, c) i++ } block.Advance(i)