Skip to content

Commit

Permalink
Fix build with Go 1.24
Browse files Browse the repository at this point in the history
Go 1.24 provides stricter checking that forbids passing a variable as
a format string to Printf-family functions with no other arguments. Remove
instances of this. See also:

https://tip.golang.org/doc/go1.24#vet

Signed-off-by: W. Michael Petullo <[email protected]>
  • Loading branch information
flyn-org committed Jan 21, 2025
1 parent 8de4ffb commit 5bf771b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions common/hugio/hasBytesWriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ func TestHasBytesWriter(t *testing.T) {

for i := 0; i < 22; i++ {
h, w := neww()
fmt.Fprintf(w, rndStr()+"abc __foobar"+rndStr())
fmt.Fprint(w, rndStr()+"abc __foobar"+rndStr())
c.Assert(h.Patterns[0].Match, qt.Equals, true)

h, w = neww()
fmt.Fprintf(w, rndStr()+"abc __f")
fmt.Fprintf(w, "oo bar"+rndStr())
fmt.Fprint(w, rndStr()+"abc __f")
fmt.Fprint(w, "oo bar"+rndStr())
c.Assert(h.Patterns[0].Match, qt.Equals, true)

h, w = neww()
fmt.Fprintf(w, rndStr()+"abc __moo bar")
fmt.Fprint(w, rndStr()+"abc __moo bar")
c.Assert(h.Patterns[0].Match, qt.Equals, false)
}

Expand Down
2 changes: 1 addition & 1 deletion common/hugo/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func DeprecateLevel(item, alternative, version string, level logg.Level) {
msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in a future release. %s", item, version, alternative)
}

loggers.Log().Logger().WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf(msg)
loggers.Log().Logger().WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf("%s", msg)
}

// We usually do about one minor version a month.
Expand Down

0 comments on commit 5bf771b

Please sign in to comment.