@@ -150,10 +150,10 @@ func PrintfTests() {
150
150
fmt .Printf ("%s" , nonemptyinterface ) // correct (the type is responsible for formatting)
151
151
fmt .Printf ("%.*s %d %6g" , 3 , "hi" , 23 , 'x' ) // want "fmt.Printf format %6g has arg 'x' of wrong type rune"
152
152
fmt .Println () // not an error
153
- fmt .Println ("%s" , "hi" ) // want "fmt.Println call contains %s, possibly intended as Printf formatting directive"
154
- fmt .Println ("%v" , "hi" ) // want "fmt.Println call contains %v, possibly intended as Printf formatting directive"
155
- fmt .Println ("%T" , "hi" ) // want "fmt.Println call contains %T, possibly intended as Printf formatting directive"
156
- fmt .Println ("%s" + " there" , "hi" ) // want "fmt.Println call contains %s, possibly intended as Printf formatting directive"
153
+ fmt .Println ("%s" , "hi" ) // want "fmt.Println call has possible Printf formatting directive %s "
154
+ fmt .Println ("%v" , "hi" ) // want "fmt.Println call has possible Printf formatting directive %v "
155
+ fmt .Println ("%T" , "hi" ) // want "fmt.Println call has possible Printf formatting directive %T "
156
+ fmt .Println ("%s" + " there" , "hi" ) // want "fmt.Println call has possible Printf formatting directive %s "
157
157
fmt .Println ("0.0%" ) // correct (trailing % couldn't be a formatting directive)
158
158
fmt .Printf ("%s" , "hi" , 3 ) // want "fmt.Printf call needs 1 arg but has 2 args"
159
159
_ = fmt .Sprintf ("%" + ("s" ), "hi" , 3 ) // want "fmt.Sprintf call needs 1 arg but has 2 args"
@@ -177,19 +177,19 @@ func PrintfTests() {
177
177
Printf (format , "hi" ) // want "a.Printf format %s reads arg #2, but call has 1 arg$"
178
178
Printf ("%s %d %.3v %q" , "str" , 4 ) // want "a.Printf format %.3v reads arg #3, but call has 2 args"
179
179
f := new (ptrStringer )
180
- f .Warn (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Warn call contains %s, possibly intended as Printf formatting directive`
180
+ f .Warn (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Warn call has possible Printf formatting directive %s `
181
181
f .Warnf (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Warnf call needs 1 arg but has 2 args`
182
182
f .Warnf (0 , "%r" , "hello" ) // want `\(\*a.ptrStringer\).Warnf format %r has unknown verb r`
183
183
f .Warnf (0 , "%#s" , "hello" ) // want `\(\*a.ptrStringer\).Warnf format %#s has unrecognized flag #`
184
- f .Warn2 (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Warn2 call contains %s, possibly intended as Printf formatting directive`
184
+ f .Warn2 (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Warn2 call has possible Printf formatting directive %s `
185
185
f .Warnf2 (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Warnf2 call needs 1 arg but has 2 args`
186
186
f .Warnf2 (0 , "%r" , "hello" ) // want `\(\*a.ptrStringer\).Warnf2 format %r has unknown verb r`
187
187
f .Warnf2 (0 , "%#s" , "hello" ) // want `\(\*a.ptrStringer\).Warnf2 format %#s has unrecognized flag #`
188
- f .Wrap (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Wrap call contains %s, possibly intended as Printf formatting directive`
188
+ f .Wrap (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Wrap call has possible Printf formatting directive %s `
189
189
f .Wrapf (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Wrapf call needs 1 arg but has 2 args`
190
190
f .Wrapf (0 , "%r" , "hello" ) // want `\(\*a.ptrStringer\).Wrapf format %r has unknown verb r`
191
191
f .Wrapf (0 , "%#s" , "hello" ) // want `\(\*a.ptrStringer\).Wrapf format %#s has unrecognized flag #`
192
- f .Wrap2 (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Wrap2 call contains %s, possibly intended as Printf formatting directive`
192
+ f .Wrap2 (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Wrap2 call has possible Printf formatting directive %s `
193
193
f .Wrapf2 (0 , "%s" , "hello" , 3 ) // want `\(\*a.ptrStringer\).Wrapf2 call needs 1 arg but has 2 args`
194
194
f .Wrapf2 (0 , "%r" , "hello" ) // want `\(\*a.ptrStringer\).Wrapf2 format %r has unknown verb r`
195
195
f .Wrapf2 (0 , "%#s" , "hello" ) // want `\(\*a.ptrStringer\).Wrapf2 format %#s has unrecognized flag #`
@@ -226,7 +226,7 @@ func PrintfTests() {
226
226
var et1 * testing.T
227
227
et1 .Error () // ok
228
228
et1 .Error ("hi" ) // ok
229
- et1 .Error ("%d" , 3 ) // want `\(\*testing.common\).Error call contains %d, possibly intended as Printf formatting directive`
229
+ et1 .Error ("%d" , 3 ) // want `\(\*testing.common\).Error call has possible Printf formatting directive %d `
230
230
et1 .Errorf ("%s" , 1 ) // want `\(\*testing.common\).Errorf format %s has arg 1 of wrong type int`
231
231
var et3 errorTest3
232
232
et3 .Error () // ok, not an error method.
@@ -253,7 +253,7 @@ func PrintfTests() {
253
253
// Special handling for Log.
254
254
math .Log (3 ) // OK
255
255
var t * testing.T
256
- t .Log ("%d" , 3 ) // want `\(\*testing.common\).Log call contains %d, possibly intended as Printf formatting directive`
256
+ t .Log ("%d" , 3 ) // want `\(\*testing.common\).Log call has possible Printf formatting directive %d `
257
257
t .Logf ("%d" , 3 )
258
258
t .Logf ("%d" , "hi" ) // want `\(\*testing.common\).Logf format %d has arg "hi" of wrong type string`
259
259
@@ -307,27 +307,27 @@ func PrintfTests() {
307
307
Printf (someString (), "hello" ) // OK
308
308
309
309
// Printf wrappers in package log should be detected automatically
310
- logpkg .Fatal ("%d" , 1 ) // want "log.Fatal call contains %d, possibly intended as Printf formatting directive"
310
+ logpkg .Fatal ("%d" , 1 ) // want "log.Fatal call has possible Printf formatting directive %d "
311
311
logpkg .Fatalf ("%d" , "x" ) // want `log.Fatalf format %d has arg "x" of wrong type string`
312
- logpkg .Fatalln ("%d" , 1 ) // want "log.Fatalln call contains %d, possibly intended as Printf formatting directive"
313
- logpkg .Panic ("%d" , 1 ) // want "log.Panic call contains %d, possibly intended as Printf formatting directive"
312
+ logpkg .Fatalln ("%d" , 1 ) // want "log.Fatalln call has possible Printf formatting directive %d "
313
+ logpkg .Panic ("%d" , 1 ) // want "log.Panic call has possible Printf formatting directive %d "
314
314
logpkg .Panicf ("%d" , "x" ) // want `log.Panicf format %d has arg "x" of wrong type string`
315
- logpkg .Panicln ("%d" , 1 ) // want "log.Panicln call contains %d, possibly intended as Printf formatting directive"
316
- logpkg .Print ("%d" , 1 ) // want "log.Print call contains %d, possibly intended as Printf formatting directive"
315
+ logpkg .Panicln ("%d" , 1 ) // want "log.Panicln call has possible Printf formatting directive %d "
316
+ logpkg .Print ("%d" , 1 ) // want "log.Print call has possible Printf formatting directive %d "
317
317
logpkg .Printf ("%d" , "x" ) // want `log.Printf format %d has arg "x" of wrong type string`
318
- logpkg .Println ("%d" , 1 ) // want "log.Println call contains %d, possibly intended as Printf formatting directive"
318
+ logpkg .Println ("%d" , 1 ) // want "log.Println call has possible Printf formatting directive %d "
319
319
320
320
// Methods too.
321
321
var l * logpkg.Logger
322
- l .Fatal ("%d" , 1 ) // want `\(\*log.Logger\).Fatal call contains %d, possibly intended as Printf formatting directive`
322
+ l .Fatal ("%d" , 1 ) // want `\(\*log.Logger\).Fatal call has possible Printf formatting directive %d `
323
323
l .Fatalf ("%d" , "x" ) // want `\(\*log.Logger\).Fatalf format %d has arg "x" of wrong type string`
324
- l .Fatalln ("%d" , 1 ) // want `\(\*log.Logger\).Fatalln call contains %d, possibly intended as Printf formatting directive`
325
- l .Panic ("%d" , 1 ) // want `\(\*log.Logger\).Panic call contains %d, possibly intended as Printf formatting directive`
324
+ l .Fatalln ("%d" , 1 ) // want `\(\*log.Logger\).Fatalln call has possible Printf formatting directive %d `
325
+ l .Panic ("%d" , 1 ) // want `\(\*log.Logger\).Panic call has possible Printf formatting directive %d `
326
326
l .Panicf ("%d" , "x" ) // want `\(\*log.Logger\).Panicf format %d has arg "x" of wrong type string`
327
- l .Panicln ("%d" , 1 ) // want `\(\*log.Logger\).Panicln call contains %d, possibly intended as Printf formatting directive`
328
- l .Print ("%d" , 1 ) // want `\(\*log.Logger\).Print call contains %d, possibly intended as Printf formatting directive`
327
+ l .Panicln ("%d" , 1 ) // want `\(\*log.Logger\).Panicln call has possible Printf formatting directive %d `
328
+ l .Print ("%d" , 1 ) // want `\(\*log.Logger\).Print call has possible Printf formatting directive %d `
329
329
l .Printf ("%d" , "x" ) // want `\(\*log.Logger\).Printf format %d has arg "x" of wrong type string`
330
- l .Println ("%d" , 1 ) // want `\(\*log.Logger\).Println call contains %d, possibly intended as Printf formatting directive`
330
+ l .Println ("%d" , 1 ) // want `\(\*log.Logger\).Println call has possible Printf formatting directive %d `
331
331
332
332
// Issue 26486
333
333
dbg ("" , 1 ) // no error "call has arguments but no formatting directive"
@@ -361,7 +361,7 @@ func PrintfTests() {
361
361
eis .Errorf (0 , "%w" , err ) // OK
362
362
ess .Errorf ("ERROR" , "%w" , err ) // OK
363
363
fmt .Appendf (nil , "%d" , "123" ) // want `wrong type`
364
- fmt .Append (nil , "%d" , 123 ) // want `possibly intended as Printf formatting directive`
364
+ fmt .Append (nil , "%d" , 123 ) // want `fmt.Append call has possible Printf formatting directive %d `
365
365
366
366
}
367
367
@@ -839,7 +839,7 @@ func PointersToCompoundTypes() {
839
839
// Printf wrappers from external package
840
840
func externalPackage () {
841
841
b .Wrapf ("%s" , 1 ) // want "Wrapf format %s has arg 1 of wrong type int"
842
- b .Wrap ("%s" , 1 ) // want "Wrap call contains %s, possibly intended as Printf formatting directive"
842
+ b .Wrap ("%s" , 1 ) // want "Wrap call has possible Printf formatting directive %s "
843
843
b .NoWrap ("%s" , 1 )
844
844
b .Wrapf2 ("%s" , 1 ) // want "Wrapf2 format %s has arg 1 of wrong type int"
845
845
}
0 commit comments