]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Fix build with Go 1.24
authorW. Michael Petullo <mike@flyn.org>
Tue, 21 Jan 2025 01:34:39 +0000 (19:34 -0600)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 21 Jan 2025 10:10:03 +0000 (11:10 +0100)
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>
common/hugio/hasBytesWriter_test.go
common/hugo/hugo.go

index 49487ab0bb7cbe2546b7778af6336100243bf832..f0d6c3a7bde675fb15b4709694d79954c1765eea 100644 (file)
@@ -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)
        }
 
index e480baa94ea357970271cf2c39c721c242b5b360..eecf4bc2f67d4eeb11e6c43eca5d89c44dc38ba0 100644 (file)
@@ -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.