mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
all: Run modernize -fix ./...
This commit is contained in:
@@ -77,7 +77,7 @@ func (r *htmlRenderer) renderCodeBlock(w util.BufWriter, src []byte, node ast.No
|
||||
var buff bytes.Buffer
|
||||
|
||||
l := n.Lines().Len()
|
||||
for i := 0; i < l; i++ {
|
||||
for i := range l {
|
||||
line := n.Lines().At(i)
|
||||
buff.Write(line.Value(src))
|
||||
}
|
||||
|
@@ -182,7 +182,7 @@ func (r *hugoContextRenderer) renderHTMLBlock(
|
||||
if entering {
|
||||
if r.Unsafe {
|
||||
l := n.Lines().Len()
|
||||
for i := 0; i < l; i++ {
|
||||
for i := range l {
|
||||
line := n.Lines().At(i)
|
||||
linev := line.Value(source)
|
||||
var stripped bool
|
||||
@@ -226,7 +226,7 @@ func (r *hugoContextRenderer) renderRawHTML(
|
||||
n := node.(*ast.RawHTML)
|
||||
l := n.Segments.Len()
|
||||
if r.Unsafe {
|
||||
for i := 0; i < l; i++ {
|
||||
for i := range l {
|
||||
segment := n.Segments.At(i)
|
||||
_, _ = w.Write(segment.Value(source))
|
||||
}
|
||||
|
@@ -110,7 +110,7 @@ func (r *htmlRenderer) renderPassthroughBlock(w util.BufWriter, src []byte, node
|
||||
case (*passthrough.PassthroughBlock):
|
||||
l := nn.Lines().Len()
|
||||
var buff bytes.Buffer
|
||||
for i := 0; i < l; i++ {
|
||||
for i := range l {
|
||||
line := nn.Lines().At(i)
|
||||
buff.Write(line.Value(src))
|
||||
}
|
||||
|
@@ -100,10 +100,7 @@ func (c *rstConverter) getRstContent(src []byte, ctx converter.DocumentContext)
|
||||
|
||||
bodyEnd := bytes.Index(result, []byte("\n</body>"))
|
||||
if bodyEnd < 0 || bodyEnd >= len(result) {
|
||||
bodyEnd = len(result) - 1
|
||||
if bodyEnd < 0 {
|
||||
bodyEnd = 0
|
||||
}
|
||||
bodyEnd = max(len(result)-1, 0)
|
||||
}
|
||||
|
||||
return result[bodyStart+7 : bodyEnd], err
|
||||
|
@@ -250,7 +250,7 @@ func (b *tocBuilder) writeHeading(level, indent int, h *Heading) {
|
||||
}
|
||||
|
||||
func (b *tocBuilder) indent(n int) {
|
||||
for i := 0; i < n; i++ {
|
||||
for range n {
|
||||
b.s.WriteString(" ")
|
||||
}
|
||||
}
|
||||
|
@@ -196,7 +196,7 @@ func TestTocMisc(t *testing.T) {
|
||||
func BenchmarkToc(b *testing.B) {
|
||||
newTocs := func(n int) []*Fragments {
|
||||
var tocs []*Fragments
|
||||
for i := 0; i < n; i++ {
|
||||
for range n {
|
||||
tocs = append(tocs, newTestToc())
|
||||
}
|
||||
return tocs
|
||||
|
Reference in New Issue
Block a user