GoPLS Viewer

Home|gopls/go/analysis/passes/printf/testdata/src/b/b.go
1package b
2
3import "fmt"
4
5// Wrapf is a printf wrapper.
6func Wrapf(format stringargs ...interface{}) { // want Wrapf:"printfWrapper"
7    fmt.Sprintf(formatargs...)
8}
9
10// Wrap is a print wrapper.
11func Wrap(args ...interface{}) { // want Wrap:"printWrapper"
12    fmt.Sprint(args...)
13}
14
15// NoWrap is not a wrapper.
16func NoWrap(format stringargs ...interface{}) {
17}
18
19// Wrapf2 is another printf wrapper.
20func Wrapf2(format stringargs ...interface{}) string { // want Wrapf2:"printfWrapper"
21
22    // This statement serves as an assertion that this function is a
23    // printf wrapper and that calls to it should be checked
24    // accordingly, even though the delegation below is obscured by
25    // the "("+format+")" operations.
26    if false {
27        fmt.Sprintf(formatargs...)
28    }
29
30    // Effectively a printf delegation,
31    // but the printf checker can't see it.
32    return fmt.Sprintf("("+format+")"args...)
33}
34
MembersX
Wrapf.format
NoWrap.format
NoWrap.args
Wrapf2.format
fmt
Wrapf
Wrap.args
NoWrap
Wrapf2
Wrapf2.args
Wrapf.args
Wrap
Members
X