GoPLS Viewer

Home|gopls/go/analysis/passes/printf/testdata/src/a/a.go
1// Copyright 2010 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// This file contains tests for the printf checker.
6
7package a
8
9import (
10    "fmt"
11    logpkg "log" // renamed to make it harder to see
12    "math"
13    "os"
14    "testing"
15    "unsafe" // just for test case printing unsafe.Pointer
16
17    // For testing printf-like functions from external package.
18    // "github.com/foobar/externalprintf"
19    "b"
20)
21
22func UnsafePointerPrintfTest() {
23    var up unsafe.Pointer
24    fmt.Printf("%p, %x %X"upupup)
25}
26
27// Error methods that do not satisfy the Error interface and should be checked.
28type errorTest1 int
29
30func (errorTest1Error(...interface{}) string {
31    return "hi"
32}
33
34type errorTest2 int // Analogous to testing's *T type.
35func (errorTest2Error(...interface{}) {
36}
37
38type errorTest3 int
39
40func (errorTest3Error() { // No return value.
41}
42
43type errorTest4 int
44
45func (errorTest4Error() int { // Different return type.
46    return 3
47}
48
49type errorTest5 int
50
51func (errorTest5error() { // niladic; don't complain if no args (was bug)
52}
53
54type errorTestOK int
55
56func (errorTestOKError() string { return "" }
57
58// This function never executes, but it serves as a simple test for the program.
59// Test with make test.
60func PrintfTests() {
61    var b bool
62    var i int
63    var r rune
64    var s string
65    var x float64
66    var p *int
67    var imap map[int]int
68    var fslice []float64
69    var c complex64
70    var err error
71    // Some good format/argtypes
72    fmt.Printf("")
73    fmt.Printf("%b %b %b"3ix)
74    fmt.Printf("%c %c %c %c"3i'x'r)
75    fmt.Printf("%d %d %d"3iimap)
76    fmt.Printf("%e %e %e %e"3e9xfslicec)
77    fmt.Printf("%E %E %E %E"3e9xfslicec)
78    fmt.Printf("%f %f %f %f"3e9xfslicec)
79    fmt.Printf("%F %F %F %F"3e9xfslicec)
80    fmt.Printf("%g %g %g %g"3e9xfslicec)
81    fmt.Printf("%G %G %G %G"3e9xfslicec)
82    fmt.Printf("%b %b %b %b"3e9xfslicec)
83    fmt.Printf("%o %o"3i)
84    fmt.Printf("%O %O"3i)
85    fmt.Printf("%p"p)
86    fmt.Printf("%q %q %q %q"3i'x'r)
87    fmt.Printf("%s %s %s""hi"s, []byte{65})
88    fmt.Printf("%t %t"trueb)
89    fmt.Printf("%T %T"3i)
90    fmt.Printf("%U %U"3i)
91    fmt.Printf("%v %v"3i)
92    fmt.Printf("%x %x %x %x %x %x %x"3i"hi"sxcfslice)
93    fmt.Printf("%X %X %X %X %X %X %X"3i"hi"sxcfslice)
94    fmt.Printf("%.*s %d %g"3"hi"232.3)
95    fmt.Printf("%s", &stringerv)
96    fmt.Printf("%v", &stringerv)
97    fmt.Printf("%T", &stringerv)
98    fmt.Printf("%s", &embeddedStringerv)
99    fmt.Printf("%v", &embeddedStringerv)
100    fmt.Printf("%T", &embeddedStringerv)
101    fmt.Printf("%v"notstringerv)
102    fmt.Printf("%T"notstringerv)
103    fmt.Printf("%q"stringerarrayv)
104    fmt.Printf("%v"stringerarrayv)
105    fmt.Printf("%s"stringerarrayv)
106    fmt.Printf("%v"notstringerarrayv)
107    fmt.Printf("%T"notstringerarrayv)
108    fmt.Printf("%d"new(fmt.Formatter))
109    fmt.Printf("%*%"2)                              // Ridiculous but allowed.
110    fmt.Printf("%s", interface{}(nil))                // Nothing useful we can say.
111    fmt.Printf("%a", interface{}(new(BoolFormatter))) // Could be a fmt.Formatter.
112
113    fmt.Printf("%g"1+2i)
114    fmt.Printf("%#e %#E %#f %#F %#g %#G"1.21.21.21.21.21.2// OK since Go 1.9
115    // Some bad format/argTypes
116    fmt.Printf("%b""hi")                      // want "fmt.Printf format %b has arg \x22hi\x22 of wrong type string"
117    fmt.Printf("%t"c)                         // want "fmt.Printf format %t has arg c of wrong type complex64"
118    fmt.Printf("%t"1+2i)                      // want `fmt.Printf format %t has arg 1 \+ 2i of wrong type complex128`
119    fmt.Printf("%c"2.3)                       // want "fmt.Printf format %c has arg 2.3 of wrong type float64"
120    fmt.Printf("%d"2.3)                       // want "fmt.Printf format %d has arg 2.3 of wrong type float64"
121    fmt.Printf("%e""hi")                      // want `fmt.Printf format %e has arg "hi" of wrong type string`
122    fmt.Printf("%E"true)                      // want "fmt.Printf format %E has arg true of wrong type bool"
123    fmt.Printf("%f""hi")                      // want "fmt.Printf format %f has arg \x22hi\x22 of wrong type string"
124    fmt.Printf("%F"'x')                       // want "fmt.Printf format %F has arg 'x' of wrong type rune"
125    fmt.Printf("%g""hi")                      // want `fmt.Printf format %g has arg "hi" of wrong type string`
126    fmt.Printf("%g"imap)                      // want `fmt.Printf format %g has arg imap of wrong type map\[int\]int`
127    fmt.Printf("%G"i)                         // want "fmt.Printf format %G has arg i of wrong type int"
128    fmt.Printf("%o"x)                         // want "fmt.Printf format %o has arg x of wrong type float64"
129    fmt.Printf("%O"x)                         // want "fmt.Printf format %O has arg x of wrong type float64"
130    fmt.Printf("%p"nil)                       // want "fmt.Printf format %p has arg nil of wrong type untyped nil"
131    fmt.Printf("%p"23)                        // want "fmt.Printf format %p has arg 23 of wrong type int"
132    fmt.Printf("%q"x)                         // want "fmt.Printf format %q has arg x of wrong type float64"
133    fmt.Printf("%s"b)                         // want "fmt.Printf format %s has arg b of wrong type bool"
134    fmt.Printf("%s"byte(65))                  // want `fmt.Printf format %s has arg byte\(65\) of wrong type byte`
135    fmt.Printf("%t"23)                        // want "fmt.Printf format %t has arg 23 of wrong type int"
136    fmt.Printf("%U"x)                         // want "fmt.Printf format %U has arg x of wrong type float64"
137    fmt.Printf("%x"nil)                       // want "fmt.Printf format %x has arg nil of wrong type untyped nil"
138    fmt.Printf("%s"stringerv)                 // want "fmt.Printf format %s has arg stringerv of wrong type a.ptrStringer"
139    fmt.Printf("%t"stringerv)                 // want "fmt.Printf format %t has arg stringerv of wrong type a.ptrStringer"
140    fmt.Printf("%s"embeddedStringerv)         // want "fmt.Printf format %s has arg embeddedStringerv of wrong type a.embeddedStringer"
141    fmt.Printf("%t"embeddedStringerv)         // want "fmt.Printf format %t has arg embeddedStringerv of wrong type a.embeddedStringer"
142    fmt.Printf("%q"notstringerv)              // want "fmt.Printf format %q has arg notstringerv of wrong type a.notstringer"
143    fmt.Printf("%t"notstringerv)              // want "fmt.Printf format %t has arg notstringerv of wrong type a.notstringer"
144    fmt.Printf("%t"stringerarrayv)            // want "fmt.Printf format %t has arg stringerarrayv of wrong type a.stringerarray"
145    fmt.Printf("%t"notstringerarrayv)         // want "fmt.Printf format %t has arg notstringerarrayv of wrong type a.notstringerarray"
146    fmt.Printf("%q"notstringerarrayv)         // want "fmt.Printf format %q has arg notstringerarrayv of wrong type a.notstringerarray"
147    fmt.Printf("%d"BoolFormatter(true))       // want `fmt.Printf format %d has arg BoolFormatter\(true\) of wrong type a.BoolFormatter`
148    fmt.Printf("%z"FormatterVal(true))        // correct (the type is responsible for formatting)
149    fmt.Printf("%d"FormatterVal(true))        // correct (the type is responsible for formatting)
150    fmt.Printf("%s"nonemptyinterface)         // correct (the type is responsible for formatting)
151    fmt.Printf("%.*s %d %6g"3"hi"23'x'// want "fmt.Printf format %6g has arg 'x' of wrong type rune"
152    fmt.Println()                               // not an error
153    fmt.Println("%s""hi")                     // want "fmt.Println call has possible formatting directive %s"
154    fmt.Println("%v""hi")                     // want "fmt.Println call has possible formatting directive %v"
155    fmt.Println("%T""hi")                     // want "fmt.Println call has possible formatting directive %T"
156    fmt.Println("%s"+" there""hi")            // want "fmt.Println call has possible formatting directive %s"
157    fmt.Println("0.0%")                         // correct (trailing % couldn't be a formatting directive)
158    fmt.Printf("%s""hi"3)                   // want "fmt.Printf call needs 1 arg but has 2 args"
159    _ = fmt.Sprintf("%"+("s"), "hi"3)         // want "fmt.Sprintf call needs 1 arg but has 2 args"
160    fmt.Printf("%s%%%d""hi"3)               // correct
161    fmt.Printf("%08s""woo")                   // correct
162    fmt.Printf("% 8s""woo")                   // correct
163    fmt.Printf("%.*d"33)                    // correct
164    fmt.Printf("%.*d x"3333)            // want "fmt.Printf call needs 2 args but has 4 args"
165    fmt.Printf("%.*d x""hi"3)               // want `fmt.Printf format %.*d uses non-int "hi" as argument of \*`
166    fmt.Printf("%.*d x"i3)                  // correct
167    fmt.Printf("%.*d x"s3)                  // want `fmt.Printf format %.\*d uses non-int s as argument of \*`
168    fmt.Printf("%*% x"0.22)                   // want `fmt.Printf format %\*% uses non-int 0.22 as argument of \*`
169    fmt.Printf("%q %q"multi()...)             // ok
170    fmt.Printf("%#q"`blah`)                   // ok
171    fmt.Printf("%#b"3)                        // ok
172    // printf("now is the time", "buddy")          // no error "a.printf call has arguments but no formatting directives"
173    Printf("now is the time""buddy"// want "a.Printf call has arguments but no formatting directives"
174    Printf("hi")                       // ok
175    const format = "%s %s\n"
176    Printf(format"hi""there")
177    Printf(format"hi")              // want "a.Printf format %s reads arg #2, but call has 1 arg$"
178    Printf("%s %d %.3v %q""str"4// want "a.Printf format %.3v reads arg #3, but call has 2 args"
179    f := new(ptrStringer)
180    f.Warn(0"%s""hello"3)           // want `\(\*a.ptrStringer\).Warn call has possible formatting directive %s`
181    f.Warnf(0"%s""hello"3)          // want `\(\*a.ptrStringer\).Warnf call needs 1 arg but has 2 args`
182    f.Warnf(0"%r""hello")             // want `\(\*a.ptrStringer\).Warnf format %r has unknown verb r`
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 has possible formatting directive %s`
185    f.Warnf2(0"%s""hello"3)         // want `\(\*a.ptrStringer\).Warnf2 call needs 1 arg but has 2 args`
186    f.Warnf2(0"%r""hello")            // want `\(\*a.ptrStringer\).Warnf2 format %r has unknown verb r`
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 has possible formatting directive %s`
189    f.Wrapf(0"%s""hello"3)          // want `\(\*a.ptrStringer\).Wrapf call needs 1 arg but has 2 args`
190    f.Wrapf(0"%r""hello")             // want `\(\*a.ptrStringer\).Wrapf format %r has unknown verb r`
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 has possible formatting directive %s`
193    f.Wrapf2(0"%s""hello"3)         // want `\(\*a.ptrStringer\).Wrapf2 call needs 1 arg but has 2 args`
194    f.Wrapf2(0"%r""hello")            // want `\(\*a.ptrStringer\).Wrapf2 format %r has unknown verb r`
195    f.Wrapf2(0"%#s""hello")           // want `\(\*a.ptrStringer\).Wrapf2 format %#s has unrecognized flag #`
196    fmt.Printf("%#s"FormatterVal(true)) // correct (the type is responsible for formatting)
197    Printf("d%"2)                       // want "a.Printf format % is missing verb at end of string"
198    Printf("%d"percentDV)
199    Printf("%d", &percentDV)
200    Printf("%d"notPercentDV)  // want "a.Printf format %d has arg notPercentDV of wrong type a.notPercentDStruct"
201    Printf("%d", &notPercentDV// want `a.Printf format %d has arg &notPercentDV of wrong type \*a.notPercentDStruct`
202    Printf("%p", &notPercentDV// Works regardless: we print it as a pointer.
203    Printf("%q", &percentDV)    // want `a.Printf format %q has arg &percentDV of wrong type \*a.percentDStruct`
204    Printf("%s"percentSV)
205    Printf("%s", &percentSV)
206    // Good argument reorderings.
207    Printf("%[1]d"3)
208    Printf("%[1]*d"31)
209    Printf("%[2]*[1]d"13)
210    Printf("%[2]*.[1]*[3]d"234)
211    fmt.Fprintf(os.Stderr"%[2]*.[1]*[3]d"234// Use Fprintf to make sure we count arguments correctly.
212    // Bad argument reorderings.
213    Printf("%[xd"3)                      // want `a.Printf format %\[xd is missing closing \]`
214    Printf("%[x]d x"3)                   // want `a.Printf format has invalid argument index \[x\]`
215    Printf("%[3]*s x""hi"2)            // want `a.Printf format has invalid argument index \[3\]`
216    _ = fmt.Sprintf("%[3]d x"2)          // want `fmt.Sprintf format has invalid argument index \[3\]`
217    Printf("%[2]*.[1]*[3]d x"2"hi"4// want `a.Printf format %\[2]\*\.\[1\]\*\[3\]d uses non-int \x22hi\x22 as argument of \*`
218    Printf("%[0]s x""arg1")              // want `a.Printf format has invalid argument index \[0\]`
219    Printf("%[0]d x"1)                   // want `a.Printf format has invalid argument index \[0\]`
220    Printf("%[3]*.[2*[1]f"123)       // want `a.Printf format has invalid argument index \[2\*\[1\]`
221    // Something that satisfies the error interface.
222    var e error
223    fmt.Println(e.Error()) // ok
224    // Something that looks like an error interface but isn't, such as the (*T).Error method
225    // in the testing package.
226    var et1 *testing.T
227    et1.Error()         // ok
228    et1.Error("hi")     // ok
229    et1.Error("%d"3)  // want `\(\*testing.common\).Error call has possible formatting directive %d`
230    et1.Errorf("%s"1// want `\(\*testing.common\).Errorf format %s has arg 1 of wrong type int`
231    var et3 errorTest3
232    et3.Error() // ok, not an error method.
233    var et4 errorTest4
234    et4.Error() // ok, not an error method.
235    var et5 errorTest5
236    et5.error() // ok, not an error method.
237    // Interfaces can be used with any verb.
238    var iface interface {
239        ToTheMadness() bool // Method ToTheMadness usually returns false
240    }
241    fmt.Printf("%f"iface// ok: fmt treats interfaces as transparent and iface may well have a float concrete type
242    // Can't print a function.
243    Printf("%d"someFunction// want "a.Printf format %d arg someFunction is a func value, not called"
244    Printf("%v"someFunction// want "a.Printf format %v arg someFunction is a func value, not called"
245    Println(someFunction)      // want "a.Println arg someFunction is a func value, not called"
246    Printf("%p"someFunction// ok: maybe someone wants to see the pointer
247    Printf("%T"someFunction// ok: maybe someone wants to see the type
248    // Bug: used to recur forever.
249    Printf("%p %x"recursiveStructVrecursiveStructV.next)
250    Printf("%p %x"recursiveStruct1VrecursiveStruct1V.next// want `a.Printf format %x has arg recursiveStruct1V\.next of wrong type \*a\.RecursiveStruct2`
251    Printf("%p %x"recursiveSliceVrecursiveSliceV)
252    Printf("%p %x"recursiveMapVrecursiveMapV)
253    // Special handling for Log.
254    math.Log(3// OK
255    var t *testing.T
256    t.Log("%d"3// want `\(\*testing.common\).Log call has possible formatting directive %d`
257    t.Logf("%d"3)
258    t.Logf("%d""hi"// want `\(\*testing.common\).Logf format %d has arg "hi" of wrong type string`
259
260    Errorf(1"%d"3)    // OK
261    Errorf(1"%d""hi"// want `a.Errorf format %d has arg "hi" of wrong type string`
262
263    // Multiple string arguments before variadic args
264    errorf("WARNING""foobar")            // OK
265    errorf("INFO""s=%s, n=%d""foo"1// OK
266    errorf("ERROR""%d")                  // want "a.errorf format %d reads arg #1, but call has 0 args"
267
268    var tb testing.TB
269    tb.Errorf("%s"1// want `\(testing.TB\).Errorf format %s has arg 1 of wrong type int`
270
271    // Printf from external package
272    // externalprintf.Printf("%d", 42) // OK
273    // externalprintf.Printf("foobar") // OK
274    // level := 123
275    // externalprintf.Logf(level, "%d", 42)                        // OK
276    // externalprintf.Errorf(level, level, "foo %q bar", "foobar") // OK
277    // externalprintf.Logf(level, "%d")                            // no error "Logf format %d reads arg #1, but call has 0 args"
278    // var formatStr = "%s %s"
279    // externalprintf.Sprintf(formatStr, "a", "b")     // OK
280    // externalprintf.Logf(level, formatStr, "a", "b") // OK
281
282    // user-defined Println-like functions
283    ss := &someStruct{}
284    ss.Log(someFunction"foo")          // OK
285    ss.Error(someFunctionsomeFunction// OK
286    ss.Println()                         // OK
287    ss.Println(1.234"foo")             // OK
288    ss.Println(1someFunction)          // no error "Println arg someFunction is a func value, not called"
289    ss.log(someFunction)                 // OK
290    ss.log(someFunction"bar"1.33)    // OK
291    ss.log(someFunctionsomeFunction)   // no error "log arg someFunction is a func value, not called"
292
293    // indexed arguments
294    Printf("%d %[3]d %d %[2]d x"1234)             // OK
295    Printf("%d %[0]d %d %[2]d x"1234)             // want `a.Printf format has invalid argument index \[0\]`
296    Printf("%d %[3]d %d %[-2]d x"1234)            // want `a.Printf format has invalid argument index \[-2\]`
297    Printf("%d %[3]d %d %[2234234234234]d x"1234// want `a.Printf format has invalid argument index \[2234234234234\]`
298    Printf("%d %[3]d %-10d %[2]d x"123)             // want "a.Printf format %-10d reads arg #4, but call has 3 args"
299    Printf("%[1][3]d x"12)                            // want `a.Printf format %\[1\]\[ has unknown verb \[`
300    Printf("%[1]d x"12)                               // OK
301    Printf("%d %[3]d %d %[2]d x"12345)          // OK
302
303    // wrote Println but meant Fprintln
304    Printf("%p\n"os.Stdout)   // OK
305    Println(os.Stdout"hello"// want "a.Println does not take io.Writer but has first arg os.Stdout"
306
307    Printf(someString(), "hello"// OK
308
309    // Printf wrappers in package log should be detected automatically
310    logpkg.Fatal("%d"1)    // want "log.Fatal call has possible formatting directive %d"
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 has possible formatting directive %d"
313    logpkg.Panic("%d"1)    // want "log.Panic call has possible formatting directive %d"
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 has possible formatting directive %d"
316    logpkg.Print("%d"1)    // want "log.Print call has possible formatting directive %d"
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 has possible formatting directive %d"
319
320    // Methods too.
321    var l *logpkg.Logger
322    l.Fatal("%d"1)    // want `\(\*log.Logger\).Fatal call has possible formatting directive %d`
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 has possible formatting directive %d`
325    l.Panic("%d"1)    // want `\(\*log.Logger\).Panic call has possible formatting directive %d`
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 has possible formatting directive %d`
328    l.Print("%d"1)    // want `\(\*log.Logger\).Print call has possible formatting directive %d`
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 has possible formatting directive %d`
331
332    // Issue 26486
333    dbg(""1// no error "call has arguments but no formatting directive"
334
335    // %w
336    var errSubset interface {
337        Error() string
338        A()
339    }
340    _ = fmt.Errorf("%w"err)               // OK
341    _ = fmt.Errorf("%#w"err)              // OK
342    _ = fmt.Errorf("%[2]w %[1]s""x"err// OK
343    _ = fmt.Errorf("%[2]w %[1]s"e"x")   // want `fmt.Errorf format %\[2\]w has arg "x" of wrong type string`
344    _ = fmt.Errorf("%w""x")               // want `fmt.Errorf format %w has arg "x" of wrong type string`
345    _ = fmt.Errorf("%w %w"errerr)       // OK
346    _ = fmt.Errorf("%w", interface{}(nil))  // want `fmt.Errorf format %w has arg interface{}\(nil\) of wrong type interface{}`
347    _ = fmt.Errorf("%w"errorTestOK(0))    // concrete value implements error
348    _ = fmt.Errorf("%w"errSubset)         // interface value implements error
349    fmt.Printf("%w"err)                   // want `fmt.Printf does not support error-wrapping directive %w`
350    var wt *testing.T
351    wt.Errorf("%w"err)          // want `\(\*testing.common\).Errorf does not support error-wrapping directive %w`
352    wt.Errorf("%[1][3]d x"12// want `\(\*testing.common\).Errorf format %\[1\]\[ has unknown verb \[`
353    wt.Errorf("%[1]d x"12)    // OK
354    // Errorf is a printfWrapper, not an errorfWrapper.
355    Errorf(0"%w"err// want `a.Errorf does not support error-wrapping directive %w`
356    // %w should work on fmt.Errorf-based wrappers.
357    var es errorfStruct
358    var eis errorfIntStruct
359    var ess errorfStringStruct
360    es.Errorf("%w"err)           // OK
361    eis.Errorf(0"%w"err)       // OK
362    ess.Errorf("ERROR""%w"err// OK
363}
364
365func someString() string { return "X" }
366
367type someStruct struct{}
368
369// Log is non-variadic user-define Println-like function.
370// Calls to this func must be skipped when checking
371// for Println-like arguments.
372func (ss *someStructLog(f func(), s string) {}
373
374// Error is variadic user-define Println-like function.
375// Calls to this func mustn't be checked for Println-like arguments,
376// since variadic arguments type isn't interface{}.
377func (ss *someStructError(args ...func()) {}
378
379// Println is variadic user-defined Println-like function.
380// Calls to this func must be checked for Println-like arguments.
381func (ss *someStructPrintln(args ...interface{}) {}
382
383// log is variadic user-defined Println-like function.
384// Calls to this func must be checked for Println-like arguments.
385func (ss *someStructlog(f func(), args ...interface{}) {}
386
387// A function we use as a function value; it has no other purpose.
388func someFunction() {}
389
390// Printf is used by the test so we must declare it.
391func Printf(format stringargs ...interface{}) { // want Printf:"printfWrapper"
392    fmt.Printf(formatargs...)
393}
394
395// Println is used by the test so we must declare it.
396func Println(args ...interface{}) { // want Println:"printWrapper"
397    fmt.Println(args...)
398}
399
400// printf is used by the test so we must declare it.
401func printf(format stringargs ...interface{}) { // want printf:"printfWrapper"
402    fmt.Printf(formatargs...)
403}
404
405// Errorf is used by the test for a case in which the first parameter
406// is not a format string.
407func Errorf(i intformat stringargs ...interface{}) { // want Errorf:"printfWrapper"
408    fmt.Sprintf(formatargs...)
409}
410
411// errorf is used by the test for a case in which the function accepts multiple
412// string parameters before variadic arguments
413func errorf(levelformat stringargs ...interface{}) { // want errorf:"printfWrapper"
414    fmt.Sprintf(formatargs...)
415}
416
417type errorfStruct struct{}
418
419// Errorf is used to test %w works on errorf wrappers.
420func (errorfStructErrorf(format stringargs ...interface{}) { // want Errorf:"errorfWrapper"
421    _ = fmt.Errorf(formatargs...)
422}
423
424type errorfStringStruct struct{}
425
426// Errorf is used by the test for a case in which the function accepts multiple
427// string parameters before variadic arguments
428func (errorfStringStructErrorf(levelformat stringargs ...interface{}) { // want Errorf:"errorfWrapper"
429    _ = fmt.Errorf(formatargs...)
430}
431
432type errorfIntStruct struct{}
433
434// Errorf is used by the test for a case in which the first parameter
435// is not a format string.
436func (errorfIntStructErrorf(i intformat stringargs ...interface{}) { // want Errorf:"errorfWrapper"
437    _ = fmt.Errorf(formatargs...)
438}
439
440// multi is used by the test.
441func multi() []interface{} {
442    panic("don't call - testing only")
443}
444
445type stringer int
446
447func (stringerString() string { return "string" }
448
449type ptrStringer float64
450
451var stringerv ptrStringer
452
453func (*ptrStringerString() string {
454    return "string"
455}
456
457func (p *ptrStringerWarn2(x intargs ...interface{}) string { // want Warn2:"printWrapper"
458    return p.Warn(xargs...)
459}
460
461func (p *ptrStringerWarnf2(x intformat stringargs ...interface{}) string { // want Warnf2:"printfWrapper"
462    return p.Warnf(xformatargs...)
463}
464
465// During testing -printf.funcs flag matches Warn.
466func (*ptrStringerWarn(x intargs ...interface{}) string {
467    return "warn"
468}
469
470// During testing -printf.funcs flag matches Warnf.
471func (*ptrStringerWarnf(x intformat stringargs ...interface{}) string {
472    return "warnf"
473}
474
475func (p *ptrStringerWrap2(x intargs ...interface{}) string { // want Wrap2:"printWrapper"
476    return p.Wrap(xargs...)
477}
478
479func (p *ptrStringerWrapf2(x intformat stringargs ...interface{}) string { // want Wrapf2:"printfWrapper"
480    return p.Wrapf(xformatargs...)
481}
482
483func (*ptrStringerWrap(x intargs ...interface{}) string { // want Wrap:"printWrapper"
484    return fmt.Sprint(args...)
485}
486
487func (*ptrStringerWrapf(x intformat stringargs ...interface{}) string { // want Wrapf:"printfWrapper"
488    return fmt.Sprintf(formatargs...)
489}
490
491func (*ptrStringerBadWrap(x intargs ...interface{}) string {
492    return fmt.Sprint(args// want "missing ... in args forwarded to print-like function"
493}
494
495func (*ptrStringerBadWrapf(x intformat stringargs ...interface{}) string {
496    return fmt.Sprintf(formatargs// want "missing ... in args forwarded to printf-like function"
497}
498
499func (*ptrStringerWrapfFalsePositive(x intarg1 stringarg2 ...interface{}) string {
500    return fmt.Sprintf("%s %v"arg1arg2)
501}
502
503type embeddedStringer struct {
504    foo string
505    ptrStringer
506    bar int
507}
508
509var embeddedStringerv embeddedStringer
510
511type notstringer struct {
512    f float64
513}
514
515var notstringerv notstringer
516
517type stringerarray [4]float64
518
519func (stringerarrayString() string {
520    return "string"
521}
522
523var stringerarrayv stringerarray
524
525type notstringerarray [4]float64
526
527var notstringerarrayv notstringerarray
528
529var nonemptyinterface = interface {
530    f()
531}(nil)
532
533// A data type we can print with "%d".
534type percentDStruct struct {
535    a int
536    b []byte
537    c *float64
538}
539
540var percentDV percentDStruct
541
542// A data type we cannot print correctly with "%d".
543type notPercentDStruct struct {
544    a int
545    b []byte
546    c bool
547}
548
549var notPercentDV notPercentDStruct
550
551// A data type we can print with "%s".
552type percentSStruct struct {
553    a string
554    b []byte
555    C stringerarray
556}
557
558var percentSV percentSStruct
559
560type recursiveStringer int
561
562func (s recursiveStringerString() string {
563    _ = fmt.Sprintf("%d"s)
564    _ = fmt.Sprintf("%#v"s)
565    _ = fmt.Sprintf("%v"s)  // want `fmt.Sprintf format %v with arg s causes recursive \(a.recursiveStringer\).String method call`
566    _ = fmt.Sprintf("%v", &s// want `fmt.Sprintf format %v with arg &s causes recursive \(a.recursiveStringer\).String method call`
567    _ = fmt.Sprintf("%T"s)  // ok; does not recursively call String
568    return fmt.Sprintln(s)    // want `fmt.Sprintln arg s causes recursive call to \(a.recursiveStringer\).String method`
569}
570
571type recursivePtrStringer int
572
573func (p *recursivePtrStringerString() string {
574    _ = fmt.Sprintf("%v", *p)
575    _ = fmt.Sprint(&p)     // ok; prints address
576    return fmt.Sprintln(p// want `fmt.Sprintln arg p causes recursive call to \(\*a.recursivePtrStringer\).String method`
577}
578
579type recursiveError int
580
581func (s recursiveErrorError() string {
582    _ = fmt.Sprintf("%d"s)
583    _ = fmt.Sprintf("%#v"s)
584    _ = fmt.Sprintf("%v"s)  // want `fmt.Sprintf format %v with arg s causes recursive \(a.recursiveError\).Error method call`
585    _ = fmt.Sprintf("%v", &s// want `fmt.Sprintf format %v with arg &s causes recursive \(a.recursiveError\).Error method call`
586    _ = fmt.Sprintf("%T"s)  // ok; does not recursively call Error
587    return fmt.Sprintln(s)    // want `fmt.Sprintln arg s causes recursive call to \(a.recursiveError\).Error method`
588}
589
590type recursivePtrError int
591
592func (p *recursivePtrErrorError() string {
593    _ = fmt.Sprintf("%v", *p)
594    _ = fmt.Sprint(&p)     // ok; prints address
595    return fmt.Sprintln(p// want `fmt.Sprintln arg p causes recursive call to \(\*a.recursivePtrError\).Error method`
596}
597
598type recursiveStringerAndError int
599
600func (s recursiveStringerAndErrorString() string {
601    _ = fmt.Sprintf("%d"s)
602    _ = fmt.Sprintf("%#v"s)
603    _ = fmt.Sprintf("%v"s)  // want `fmt.Sprintf format %v with arg s causes recursive \(a.recursiveStringerAndError\).String method call`
604    _ = fmt.Sprintf("%v", &s// want `fmt.Sprintf format %v with arg &s causes recursive \(a.recursiveStringerAndError\).String method call`
605    _ = fmt.Sprintf("%T"s)  // ok; does not recursively call String
606    return fmt.Sprintln(s)    // want `fmt.Sprintln arg s causes recursive call to \(a.recursiveStringerAndError\).String method`
607}
608
609func (s recursiveStringerAndErrorError() string {
610    _ = fmt.Sprintf("%d"s)
611    _ = fmt.Sprintf("%#v"s)
612    _ = fmt.Sprintf("%v"s)  // want `fmt.Sprintf format %v with arg s causes recursive \(a.recursiveStringerAndError\).Error method call`
613    _ = fmt.Sprintf("%v", &s// want `fmt.Sprintf format %v with arg &s causes recursive \(a.recursiveStringerAndError\).Error method call`
614    _ = fmt.Sprintf("%T"s)  // ok; does not recursively call Error
615    return fmt.Sprintln(s)    // want `fmt.Sprintln arg s causes recursive call to \(a.recursiveStringerAndError\).Error method`
616}
617
618type recursivePtrStringerAndError int
619
620func (p *recursivePtrStringerAndErrorString() string {
621    _ = fmt.Sprintf("%v", *p)
622    _ = fmt.Sprint(&p)     // ok; prints address
623    return fmt.Sprintln(p// want `fmt.Sprintln arg p causes recursive call to \(\*a.recursivePtrStringerAndError\).String method`
624}
625
626func (p *recursivePtrStringerAndErrorError() string {
627    _ = fmt.Sprintf("%v", *p)
628    _ = fmt.Sprint(&p)     // ok; prints address
629    return fmt.Sprintln(p// want `fmt.Sprintln arg p causes recursive call to \(\*a.recursivePtrStringerAndError\).Error method`
630}
631
632// implements a String() method but with non-matching return types
633type nonStringerWrongReturn int
634
635func (s nonStringerWrongReturnString() (stringerror) {
636    return ""fmt.Errorf("%v"s)
637}
638
639// implements a String() method but with non-matching arguments
640type nonStringerWrongArgs int
641
642func (s nonStringerWrongArgsString(i intstring {
643    return fmt.Sprintf("%d%v"is)
644}
645
646type cons struct {
647    car int
648    cdr *cons
649}
650
651func (cons *consString() string {
652    if cons == nil {
653        return "nil"
654    }
655    _ = fmt.Sprint(cons.cdr)                            // don't want "recursive call" diagnostic
656    return fmt.Sprintf("(%d . %v)"cons.carcons.cdr// don't want "recursive call" diagnostic
657}
658
659type BoolFormatter bool
660
661func (*BoolFormatterFormat(fmt.Staterune) {
662}
663
664// Formatter with value receiver
665type FormatterVal bool
666
667func (FormatterValFormat(fmt.Staterune) {
668}
669
670type RecursiveSlice []RecursiveSlice
671
672var recursiveSliceV = &RecursiveSlice{}
673
674type RecursiveMap map[int]RecursiveMap
675
676var recursiveMapV = make(RecursiveMap)
677
678type RecursiveStruct struct {
679    next *RecursiveStruct
680}
681
682var recursiveStructV = &RecursiveStruct{}
683
684type RecursiveStruct1 struct {
685    next *RecursiveStruct2
686}
687
688type RecursiveStruct2 struct {
689    next *RecursiveStruct1
690}
691
692var recursiveStruct1V = &RecursiveStruct1{}
693
694type unexportedInterface struct {
695    f interface{}
696}
697
698// Issue 17798: unexported ptrStringer cannot be formatted.
699type unexportedStringer struct {
700    t ptrStringer
701}
702
703type unexportedStringerOtherFields struct {
704    s string
705    t ptrStringer
706    S string
707}
708
709// Issue 17798: unexported error cannot be formatted.
710type unexportedError struct {
711    e error
712}
713
714type unexportedErrorOtherFields struct {
715    s string
716    e error
717    S string
718}
719
720type errorer struct{}
721
722func (e errorerError() string { return "errorer" }
723
724type unexportedCustomError struct {
725    e errorer
726}
727
728type errorInterface interface {
729    error
730    ExtraMethod()
731}
732
733type unexportedErrorInterface struct {
734    e errorInterface
735}
736
737func UnexportedStringerOrError() {
738    fmt.Printf("%s"unexportedInterface{"foo"}) // ok; prints {foo}
739    fmt.Printf("%s"unexportedInterface{3})     // ok; we can't see the problem
740
741    us := unexportedStringer{}
742    fmt.Printf("%s"us)  // want "Printf format %s has arg us of wrong type a.unexportedStringer"
743    fmt.Printf("%s", &us// want "Printf format %s has arg &us of wrong type [*]a.unexportedStringer"
744
745    usf := unexportedStringerOtherFields{
746        s"foo",
747        S"bar",
748    }
749    fmt.Printf("%s"usf)  // want "Printf format %s has arg usf of wrong type a.unexportedStringerOtherFields"
750    fmt.Printf("%s", &usf// want "Printf format %s has arg &usf of wrong type [*]a.unexportedStringerOtherFields"
751
752    ue := unexportedError{
753        e: &errorer{},
754    }
755    fmt.Printf("%s"ue)  // want "Printf format %s has arg ue of wrong type a.unexportedError"
756    fmt.Printf("%s", &ue// want "Printf format %s has arg &ue of wrong type [*]a.unexportedError"
757
758    uef := unexportedErrorOtherFields{
759        s"foo",
760        e: &errorer{},
761        S"bar",
762    }
763    fmt.Printf("%s"uef)  // want "Printf format %s has arg uef of wrong type a.unexportedErrorOtherFields"
764    fmt.Printf("%s", &uef// want "Printf format %s has arg &uef of wrong type [*]a.unexportedErrorOtherFields"
765
766    uce := unexportedCustomError{
767        eerrorer{},
768    }
769    fmt.Printf("%s"uce// want "Printf format %s has arg uce of wrong type a.unexportedCustomError"
770
771    uei := unexportedErrorInterface{}
772    fmt.Printf("%s"uei)       // want "Printf format %s has arg uei of wrong type a.unexportedErrorInterface"
773    fmt.Println("foo\n""bar"// not an error
774
775    fmt.Println("foo\n")      // want "Println arg list ends with redundant newline"
776    fmt.Println("foo" + "\n"// want "Println arg list ends with redundant newline"
777    fmt.Println("foo\\n")     // not an error
778    fmt.Println(`foo\n`)      // not an error
779
780    intSlice := []int{34}
781    fmt.Printf("%s"intSlice// want `fmt.Printf format %s has arg intSlice of wrong type \[\]int`
782    nonStringerArray := [1]unexportedStringer{{}}
783    fmt.Printf("%s"nonStringerArray)  // want `fmt.Printf format %s has arg nonStringerArray of wrong type \[1\]a.unexportedStringer`
784    fmt.Printf("%s", []stringer{34})  // not an error
785    fmt.Printf("%s", [2]stringer{34}) // not an error
786}
787
788// TODO: Disable complaint about '0' for Go 1.10. To be fixed properly in 1.11.
789// See issues 23598 and 23605.
790func DisableErrorForFlag0() {
791    fmt.Printf("%0t"true)
792}
793
794// Issue 26486.
795func dbg(format stringargs ...interface{}) {
796    if format == "" {
797        format = "%v"
798    }
799    fmt.Printf(formatargs...)
800}
801
802func PointersToCompoundTypes() {
803    stringSlice := []string{"a""b"}
804    fmt.Printf("%s", &stringSlice// not an error
805
806    intSlice := []int{34}
807    fmt.Printf("%s", &intSlice// want `fmt.Printf format %s has arg &intSlice of wrong type \*\[\]int`
808
809    stringArray := [2]string{"a""b"}
810    fmt.Printf("%s", &stringArray// not an error
811
812    intArray := [2]int{34}
813    fmt.Printf("%s", &intArray// want `fmt.Printf format %s has arg &intArray of wrong type \*\[2\]int`
814
815    stringStruct := struct{ F string }{"foo"}
816    fmt.Printf("%s", &stringStruct// not an error
817
818    intStruct := struct{ F int }{3}
819    fmt.Printf("%s", &intStruct// want `fmt.Printf format %s has arg &intStruct of wrong type \*struct{F int}`
820
821    stringMap := map[string]string{"foo""bar"}
822    fmt.Printf("%s", &stringMap// not an error
823
824    intMap := map[int]int{34}
825    fmt.Printf("%s", &intMap// want `fmt.Printf format %s has arg &intMap of wrong type \*map\[int\]int`
826
827    type T2 struct {
828        X string
829    }
830    type T1 struct {
831        X *T2
832    }
833    fmt.Printf("%s\n"T1{&T2{"x"}}) // want `fmt.Printf format %s has arg T1{&T2{.x.}} of wrong type a\.T1`
834}
835
836// Printf wrappers from external package
837func externalPackage() {
838    b.Wrapf("%s"1// want "Wrapf format %s has arg 1 of wrong type int"
839    b.Wrap("%s"1)  // want "Wrap call has possible formatting directive %s"
840    b.NoWrap("%s"1)
841    b.Wrapf2("%s"1// want "Wrapf2 format %s has arg 1 of wrong type int"
842}
843
844func PointerVerbs() {
845    // Use booleans, so that we don't just format the elements like in
846    // PointersToCompoundTypes. Bools can only be formatted with verbs like
847    // %t and %v, and none of the ones below.
848    ptr := new(bool)
849    slice := []bool{}
850    array := [3]bool{}
851    map_ := map[bool]bool{}
852    chan_ := make(chan bool)
853    func_ := func(bool) {}
854
855    // %p, %b, %d, %o, %O, %x, and %X all support pointers.
856    fmt.Printf("%p"ptr)
857    fmt.Printf("%b"ptr)
858    fmt.Printf("%d"ptr)
859    fmt.Printf("%o"ptr)
860    fmt.Printf("%O"ptr)
861    fmt.Printf("%x"ptr)
862    fmt.Printf("%X"ptr)
863
864    // %p, %b, %d, %o, %O, %x, and %X all support channels.
865    fmt.Printf("%p"chan_)
866    fmt.Printf("%b"chan_)
867    fmt.Printf("%d"chan_)
868    fmt.Printf("%o"chan_)
869    fmt.Printf("%O"chan_)
870    fmt.Printf("%x"chan_)
871    fmt.Printf("%X"chan_)
872
873    // %p is the only one that supports funcs.
874    fmt.Printf("%p"func_)
875    fmt.Printf("%b"func_// want `fmt.Printf format %b arg func_ is a func value, not called`
876    fmt.Printf("%d"func_// want `fmt.Printf format %d arg func_ is a func value, not called`
877    fmt.Printf("%o"func_// want `fmt.Printf format %o arg func_ is a func value, not called`
878    fmt.Printf("%O"func_// want `fmt.Printf format %O arg func_ is a func value, not called`
879    fmt.Printf("%x"func_// want `fmt.Printf format %x arg func_ is a func value, not called`
880    fmt.Printf("%X"func_// want `fmt.Printf format %X arg func_ is a func value, not called`
881
882    // %p is the only one that supports all slices, by printing the address
883    // of the 0th element.
884    fmt.Printf("%p"slice// supported; address of 0th element
885    fmt.Printf("%b"slice// want `fmt.Printf format %b has arg slice of wrong type \[\]bool`
886
887    fmt.Printf("%d"slice// want `fmt.Printf format %d has arg slice of wrong type \[\]bool`
888
889    fmt.Printf("%o"slice// want `fmt.Printf format %o has arg slice of wrong type \[\]bool`
890    fmt.Printf("%O"slice// want `fmt.Printf format %O has arg slice of wrong type \[\]bool`
891
892    fmt.Printf("%x"slice// want `fmt.Printf format %x has arg slice of wrong type \[\]bool`
893    fmt.Printf("%X"slice// want `fmt.Printf format %X has arg slice of wrong type \[\]bool`
894
895    // None support arrays.
896    fmt.Printf("%p"array// want `fmt.Printf format %p has arg array of wrong type \[3\]bool`
897    fmt.Printf("%b"array// want `fmt.Printf format %b has arg array of wrong type \[3\]bool`
898    fmt.Printf("%d"array// want `fmt.Printf format %d has arg array of wrong type \[3\]bool`
899    fmt.Printf("%o"array// want `fmt.Printf format %o has arg array of wrong type \[3\]bool`
900    fmt.Printf("%O"array// want `fmt.Printf format %O has arg array of wrong type \[3\]bool`
901    fmt.Printf("%x"array// want `fmt.Printf format %x has arg array of wrong type \[3\]bool`
902    fmt.Printf("%X"array// want `fmt.Printf format %X has arg array of wrong type \[3\]bool`
903
904    // %p is the only one that supports all maps.
905    fmt.Printf("%p"map_// supported; address of 0th element
906    fmt.Printf("%b"map_// want `fmt.Printf format %b has arg map_ of wrong type map\[bool\]bool`
907
908    fmt.Printf("%d"map_// want `fmt.Printf format %d has arg map_ of wrong type map\[bool\]bool`
909
910    fmt.Printf("%o"map_// want `fmt.Printf format %o has arg map_ of wrong type map\[bool\]bool`
911    fmt.Printf("%O"map_// want `fmt.Printf format %O has arg map_ of wrong type map\[bool\]bool`
912
913    fmt.Printf("%x"map_// want `fmt.Printf format %x has arg map_ of wrong type map\[bool\]bool`
914    fmt.Printf("%X"map_// want `fmt.Printf format %X has arg map_ of wrong type map\[bool\]bool`
915}
916
MembersX
PrintfTests.imap
PrintfTests.eis
unexportedStringerOtherFields.t
testing
someStruct.log.ss
notPercentDStruct.b
nonStringerWrongArgs.String.s
unexportedStringer.t
unexportedErrorOtherFields.e
PrintfTests.b
someStruct.Error.ss
printf.format
errorfStruct.Errorf.format
ptrStringer.BadWrapf.format
ptrStringer.WrapfFalsePositive.arg2
cons.String.cons
RecursiveStruct.next
unexportedError
UnexportedStringerOrError
someStruct.Log.f
errorfStruct.Errorf
ptrStringer.Wrapf2.x
recursiveStringer
nonStringerWrongReturn.String.s
UnexportedStringerOrError.uce
PointersToCompoundTypes.stringMap
errorf.args
ptrStringer.BadWrapf.args
RecursiveStruct
someStruct.Log
Errorf.args
ptrStringer.Warnf2.p
percentDStruct.c
recursivePtrError
unexportedStringerOtherFields.S
embeddedStringer.foo
percentSV
PrintfTests.et3
errorfStringStruct.Errorf
ptrStringer
ptrStringer.Warn.args
UnexportedStringerOrError.intSlice
dbg
errorfIntStruct.Errorf.args
recursivePtrError.Error.p
b
recursivePtrStringer
cons.car
unexportedErrorInterface.e
errorTest2.Error
BoolFormatter.Format
UnexportedStringerOrError.nonStringerArray
PointersToCompoundTypes.stringArray
PointersToCompoundTypes.intArray
PointerVerbs
someStruct.log
Println.args
unsafe
errorf.format
ptrStringer.Wrap
PointerVerbs.array
someFunction
errorfIntStruct.Errorf.format
ptrStringer.Wrap2.x
ptrStringer.Warnf2.format
ptrStringer.Wrap.args
nonStringerWrongReturn
PrintfTests.tb
errorfStringStruct
ptrStringer.Wrap2
percentSStruct
UnexportedStringerOrError.uef
PrintfTests.i
RecursiveStruct1.next
unexportedInterface.f
unexportedCustomError.e
Println
printf
errorfIntStruct.Errorf
recursivePtrStringer.String
unexportedErrorOtherFields
os
recursivePtrStringerAndError
PointersToCompoundTypes.T2
externalPackage
PointerVerbs.slice
errorTest4
PrintfTests.p
someStruct.Println.ss
recursiveStringerAndError.Error.s
PointersToCompoundTypes.stringStruct
PointerVerbs.chan_
someStruct.Error.args
ptrStringer.Wrap2.p
someStruct.Error
errorf.level
ptrStringer.Wrapf2.format
PrintfTests.e
cons
errorTest2
ptrStringer.Warn2
recursiveStringerAndError.String
errorTest3.Error
PrintfTests.ess
ptrStringer.Warnf2
ptrStringer.BadWrap.x
recursiveError.Error
nonStringerWrongReturn.String
RecursiveStruct1
PrintfTests
someStruct.log.args
ptrStringer.String
ptrStringer.Warn2.x
percentDV
RecursiveMap
UnexportedStringerOrError.uei
Printf.format
stringer.String
stringerarray.String
percentSStruct.a
percentSStruct.C
Errorf.i
someStruct
PrintfTests.r
UnexportedStringerOrError.usf
math
PrintfTests.fslice
PrintfTests.format
someString
stringerv
ptrStringer.WrapfFalsePositive
ptrStringer.WrapfFalsePositive.arg1
notPercentDStruct
notPercentDStruct.c
recursivePtrStringerAndError.Error
unexportedStringer
unexportedErrorOtherFields.S
errorTest1.Error
recursiveError.Error.s
errorf
errorfStringStruct.Errorf.level
errorfIntStruct
UnsafePointerPrintfTest.up
errorTestOK.Error
stringerarray
recursivePtrStringerAndError.Error.p
RecursiveSlice
PointerVerbs.ptr
multi
errorer.Error.e
PointersToCompoundTypes.T1
errorTest4.Error
PrintfTests.et1
PrintfTests.es
ptrStringer.BadWrapf.x
recursiveStringer.String.s
recursiveStringer.String
ptrStringer.Warnf2.x
unexportedErrorInterface
someStruct.Println
cons.String
UnexportedStringerOrError.ue
PointerVerbs.map_
logpkg
someStruct.Log.s
ptrStringer.Warn2.args
ptrStringer.Wrapf.x
embeddedStringer
notstringerarray
nonStringerWrongArgs.String.i
cons.cdr
ptrStringer.Warnf.format
unexportedStringerOtherFields.s
Errorf.format
ptrStringer.Wrap2.args
percentDStruct.b
fmt
PrintfTests.l
errorfStringStruct.Errorf.args
embeddedStringerv
notstringerv
recursivePtrStringer.String.p
unexportedErrorOtherFields.s
PrintfTests.wt
ptrStringer.BadWrap.args
ptrStringer.BadWrapf
dbg.args
stringerarrayv
PointersToCompoundTypes.intMap
PrintfTests.f
ptrStringer.Wrap.x
ptrStringer.Wrapf.format
ptrStringer.BadWrap
recursivePtrStringerAndError.String
errorer.Error
PointersToCompoundTypes
PointersToCompoundTypes.intStruct
PrintfTests.ss
printf.args
ptrStringer.Wrapf2
notstringer
unexportedStringerOtherFields
errorTest3
errorInterface
UnexportedStringerOrError.us
PointersToCompoundTypes.T2.X
errorTestOK
errorfIntStruct.Errorf.i
ptrStringer.Warnf2.args
ptrStringer.Warn.x
ptrStringer.Wrapf2.p
notstringerarrayv
percentDStruct.a
RecursiveStruct2.next
errorTest5.error
PrintfTests.et5
someStruct.Log.ss
recursiveStringerAndError
unexportedInterface
PrintfTests.x
ptrStringer.Warn
errorfStruct.Errorf.args
notstringer.f
PrintfTests.err
ptrStringer.Warnf
ptrStringer.Wrapf2.args
ptrStringer.Warnf.args
percentSStruct.b
BoolFormatter
someStruct.Println.args
PointersToCompoundTypes.T1.X
ptrStringer.WrapfFalsePositive.x
recursiveStringerAndError.String.s
errorfStruct
ptrStringer.Warn2.p
ptrStringer.Warnf.x
ptrStringer.Wrapf
errorer
notPercentDV
FormatterVal.Format
PointersToCompoundTypes.intSlice
PrintfTests.c
PrintfTests.et4
stringer
embeddedStringer.bar
unexportedError.e
unexportedCustomError
ptrStringer.Wrapf.args
recursiveError
nonStringerWrongArgs.String
PrintfTests.t
notPercentDStruct.a
nonStringerWrongArgs
PointersToCompoundTypes.stringSlice
errorTest1
PrintfTests.s
someStruct.log.f
Printf
percentDStruct
FormatterVal
RecursiveStruct2
DisableErrorForFlag0
UnsafePointerPrintfTest
Errorf
errorfStringStruct.Errorf.format
recursiveStringerAndError.Error
recursivePtrStringerAndError.String.p
dbg.format
errorTest5
Printf.args
recursivePtrError.Error
Members
X