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

@ -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)

View file

@ -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)
}

View file

@ -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()