mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 05:30:54 +03:00
all: Run modernize -fix ./...
This commit is contained in:
parent
b7ae24b9c2
commit
521911a576
141 changed files with 302 additions and 354 deletions
|
@ -99,7 +99,7 @@ func (c ReplacingJSONMarshaller) MarshalJSON() ([]byte, error) {
|
|||
|
||||
if c.OmitEmpty {
|
||||
// It's tricky to do this with a regexp, so convert it to a map, remove zero values and convert back.
|
||||
var m map[string]interface{}
|
||||
var m map[string]any
|
||||
err = json.Unmarshal(converted, &m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -111,9 +111,9 @@ func (c ReplacingJSONMarshaller) MarshalJSON() ([]byte, error) {
|
|||
delete(m, k)
|
||||
} else {
|
||||
switch vv := v.(type) {
|
||||
case map[string]interface{}:
|
||||
case map[string]any:
|
||||
removeZeroVAlues(vv)
|
||||
case []interface{}:
|
||||
case []any:
|
||||
for _, vvv := range vv {
|
||||
if m, ok := vvv.(map[string]any); ok {
|
||||
removeZeroVAlues(m)
|
||||
|
|
|
@ -123,7 +123,7 @@ LOOP:
|
|||
|
||||
// Handle YAML or TOML front matter.
|
||||
func (l *pageLexer) lexFrontMatterSection(tp ItemType, delimr rune, name string, delim []byte) stateFunc {
|
||||
for i := 0; i < 2; i++ {
|
||||
for range 2 {
|
||||
if r := l.next(); r != delimr {
|
||||
return l.errorf("invalid %s delimiter", name)
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ func (t *Iterator) PeekWalk(walkFn func(item Item) bool) {
|
|||
// Consume is a convenience method to consume the next n tokens,
|
||||
// but back off Errors and EOF.
|
||||
func (t *Iterator) Consume(cnt int) {
|
||||
for i := 0; i < cnt; i++ {
|
||||
for range cnt {
|
||||
token := t.Next()
|
||||
if token.Type == tError || token.Type == tEOF {
|
||||
t.Backup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue