Skip to content

Commit 4b0c194

Browse files
flyn-orgbep
authored andcommitted
Fix build with Go 1.24
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 <mike@flyn.org>
1 parent 8de4ffb commit 4b0c194

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

common/hugio/hasBytesWriter_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ func TestHasBytesWriter(t *testing.T) {
4848

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

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

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

common/hugo/hugo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ func DeprecateLevel(item, alternative, version string, level logg.Level) {
423423
msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in a future release. %s", item, version, alternative)
424424
}
425425

426-
loggers.Log().Logger().WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf(msg)
426+
loggers.Log().Logger().WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf("%s", msg)
427427
}
428428

429429
// We usually do about one minor version a month.

0 commit comments

Comments
 (0)