all: Run modernize -fix ./...

This commit is contained in:
Bjørn Erik Pedersen
2025-02-26 10:15:04 +01:00
parent b7ae24b9c2
commit 521911a576
141 changed files with 302 additions and 354 deletions

View File

@@ -27,6 +27,7 @@ import (
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/tpl"
"github.com/mitchellh/mapstructure"
"slices"
)
type templateType int
@@ -187,7 +188,7 @@ func (c *templateContext) applyTransformations(n parse.Node) (bool, error) {
for i, cmd := range x.Cmds {
keep, _ := c.applyTransformations(cmd)
if !keep {
x.Cmds = append(x.Cmds[:i], x.Cmds[i+1:]...)
x.Cmds = slices.Delete(x.Cmds, i, i+1)
}
}
@@ -271,12 +272,7 @@ func (c *templateContext) applyTransformationsToNodes(nodes ...parse.Node) {
}
func (c *templateContext) hasIdent(idents []string, ident string) bool {
for _, id := range idents {
if id == ident {
return true
}
}
return false
return slices.Contains(idents, ident)
}
// collectConfig collects and parses any leading template config variable declaration.