mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
all: Run modernize -fix ./...
This commit is contained in:
@@ -109,10 +109,7 @@ func ExtractTOC(content []byte) (newcontent []byte, toc []byte) {
|
||||
|
||||
startOfTOC := bytes.Index(content, first)
|
||||
|
||||
peekEnd := len(content)
|
||||
if peekEnd > 70+startOfTOC {
|
||||
peekEnd = 70 + startOfTOC
|
||||
}
|
||||
peekEnd := min(len(content), 70+startOfTOC)
|
||||
|
||||
if startOfTOC < 0 {
|
||||
return stripEmptyNav(content), toc
|
||||
|
@@ -43,11 +43,7 @@ func Emojify(source []byte) []byte {
|
||||
|
||||
j := start + k
|
||||
|
||||
upper := j + emojiMaxSize
|
||||
|
||||
if upper > len(source) {
|
||||
upper = len(source)
|
||||
}
|
||||
upper := min(j+emojiMaxSize, len(source))
|
||||
|
||||
endEmoji := bytes.Index(source[j+1:upper], emojiDelim)
|
||||
nextWordDelim := bytes.Index(source[j:upper], emojiWordDelim)
|
||||
|
@@ -63,7 +63,7 @@ func UniqueStrings(s []string) []string {
|
||||
unique := make([]string, 0, len(s))
|
||||
for i, val := range s {
|
||||
var seen bool
|
||||
for j := 0; j < i; j++ {
|
||||
for j := range i {
|
||||
if s[j] == val {
|
||||
seen = true
|
||||
break
|
||||
@@ -83,7 +83,7 @@ func UniqueStringsReuse(s []string) []string {
|
||||
for i, val := range s {
|
||||
var seen bool
|
||||
|
||||
for j := 0; j < i; j++ {
|
||||
for j := range i {
|
||||
if s[j] == val {
|
||||
seen = true
|
||||
break
|
||||
|
@@ -89,7 +89,7 @@ func ProcessingStatsTable(w io.Writer, stats ...*ProcessingStats) {
|
||||
|
||||
var data [][]string
|
||||
|
||||
for i := 0; i < len(stats); i++ {
|
||||
for i := range stats {
|
||||
stat := stats[i]
|
||||
names[i+1] = stat.Name
|
||||
|
||||
|
@@ -101,10 +101,10 @@ func doTestAbsURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
|
||||
v := config.New()
|
||||
if multilingual {
|
||||
v.Set("languages", map[string]any{
|
||||
"fr": map[string]interface{}{
|
||||
"fr": map[string]any{
|
||||
"weight": 20,
|
||||
},
|
||||
"en": map[string]interface{}{
|
||||
"en": map[string]any{
|
||||
"weight": 10,
|
||||
},
|
||||
})
|
||||
@@ -112,7 +112,7 @@ func doTestAbsURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
|
||||
} else {
|
||||
v.Set("defaultContentLanguage", lang)
|
||||
v.Set("languages", map[string]any{
|
||||
lang: map[string]interface{}{
|
||||
lang: map[string]any{
|
||||
"weight": 10,
|
||||
},
|
||||
})
|
||||
@@ -167,10 +167,10 @@ func doTestRelURL(t testing.TB, defaultInSubDir, addLanguage, multilingual bool,
|
||||
v := config.New()
|
||||
if multilingual {
|
||||
v.Set("languages", map[string]any{
|
||||
"fr": map[string]interface{}{
|
||||
"fr": map[string]any{
|
||||
"weight": 20,
|
||||
},
|
||||
"en": map[string]interface{}{
|
||||
"en": map[string]any{
|
||||
"weight": 10,
|
||||
},
|
||||
})
|
||||
@@ -178,7 +178,7 @@ func doTestRelURL(t testing.TB, defaultInSubDir, addLanguage, multilingual bool,
|
||||
} else {
|
||||
v.Set("defaultContentLanguage", lang)
|
||||
v.Set("languages", map[string]any{
|
||||
lang: map[string]interface{}{
|
||||
lang: map[string]any{
|
||||
"weight": 10,
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user