const Doc = `check consistency of Printf format strings and arguments
The check applies to known functions (for example, those in package fmt)
as well as any detected wrappers of known functions.
A function that wants to avail itself of printf checking but is not
found by this analyzer's heuristics (for example, due to use of
dynamic calls) can insert a bogus call:
if false {
_ = fmt.Sprintf(format, args...) // enable printf checking
}
The -funcs flag specifies a comma-separated list of names of additional
known formatting functions or methods. If the name contains a period,
it must denote a specific function using one of the following forms:
dir/pkg.Function
dir/pkg.Type.Method
(*dir/pkg.Type).Method
Otherwise the name is interpreted as a case-insensitive unqualified
identifier such as "errorf". Either way, if a listed name ends in f, the
function is assumed to be Printf-like, taking a format string before the
argument list. Otherwise it is assumed to be Print-like, taking a list
of arguments with no format string.
`
var Analyzer = &analysis.Analyzer{ Name: "printf", Doc: Doc, Requires: []*analysis.Analyzer{inspect.Analyzer}, Run: run, ResultType: reflect.TypeOf((*Result)(nil)), FactTypes: []analysis.Fact{new(isWrapper)}, }
Kind is a kind of fmt function behavior.
type Kind int
const ( KindNone Kind = iota // not a fmt wrapper function KindPrint // function behaves like fmt.Print KindPrintf // function behaves like fmt.Printf KindErrorf // function behaves like fmt.Errorf )
func (kind Kind) String() string
Result is the printf analyzer's result type. Clients may query the result to learn whether a function behaves like fmt.Print or fmt.Printf.
type Result struct {
// contains filtered or unexported fields
}
func (r *Result) Kind(fn *types.Func) Kind
Kind reports whether fn behaves like fmt.Print or fmt.Printf.