For #26486 https://golang.org/cl/125039 changed the printf checking to only warn about functions that do not modify the arguments before passing them to fmt.Printf (or whatever). The example in that issue, drawn from real code, is:
func dbg(s string, va ...interface{}) {
if s == "" {
s = strings.Repeat("%v ", len(va))
}
_, fn, fl, _ := runtime.Caller(1)
fmt.Printf("dbg %s:%d: ", path.Base(fn), fl)
fmt.Printf(s, va...)
fmt.Println()
}
This can be called as dbg("", err).
The fix in CL 125039 means that we no longer issue printf warnings for functions like this:
func Prefix(s string, args ...interface{}) {
s = "error: " + s
fmt.Printf(s, args)
}
We should figure out a way to continue issuing warnings for Prefix without issuing them for dbg.
For #26486 https://golang.org/cl/125039 changed the printf checking to only warn about functions that do not modify the arguments before passing them to
fmt.Printf(or whatever). The example in that issue, drawn from real code, is:This can be called as
dbg("", err).The fix in CL 125039 means that we no longer issue printf warnings for functions like this:
We should figure out a way to continue issuing warnings for
Prefixwithout issuing them fordbg.