mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
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").
This commit is contained in:
parent
9e0189df27
commit
fa0cf89934
1 changed files with 0 additions and 5 deletions
|
|
@ -293,20 +293,17 @@ func (s *linkParser) parseLink(parent ast.Node, last *linkLabelState, block text
|
||||||
func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
||||||
block.SkipSpaces()
|
block.SkipSpaces()
|
||||||
line, _ := block.PeekLine()
|
line, _ := block.PeekLine()
|
||||||
buf := []byte{}
|
|
||||||
if block.Peek() == '<' {
|
if block.Peek() == '<' {
|
||||||
i := 1
|
i := 1
|
||||||
for i < len(line) {
|
for i < len(line) {
|
||||||
c := line[i]
|
c := line[i]
|
||||||
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
||||||
buf = append(buf, '\\', line[i+1])
|
|
||||||
i += 2
|
i += 2
|
||||||
continue
|
continue
|
||||||
} else if c == '>' {
|
} else if c == '>' {
|
||||||
block.Advance(i + 1)
|
block.Advance(i + 1)
|
||||||
return line[1:i], true
|
return line[1:i], true
|
||||||
}
|
}
|
||||||
buf = append(buf, c)
|
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
|
|
@ -316,7 +313,6 @@ func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
||||||
for i < len(line) {
|
for i < len(line) {
|
||||||
c := line[i]
|
c := line[i]
|
||||||
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
if c == '\\' && i < len(line)-1 && util.IsPunct(line[i+1]) {
|
||||||
buf = append(buf, '\\', line[i+1])
|
|
||||||
i += 2
|
i += 2
|
||||||
continue
|
continue
|
||||||
} else if c == '(' {
|
} else if c == '(' {
|
||||||
|
|
@ -329,7 +325,6 @@ func parseLinkDestination(block text.Reader) ([]byte, bool) {
|
||||||
} else if util.IsSpace(c) {
|
} else if util.IsSpace(c) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
buf = append(buf, c)
|
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
block.Advance(i)
|
block.Advance(i)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue