tools: Index | Files

package printf

import ""

Package printf defines an Analyzer that checks consistency of Printf format strings and arguments.


Package Files

printf.go types.go


const Doc = "" /* 1034 byte string literal not displayed */


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)},

type Kind Uses

type Kind int

Kind is a kind of fmt function behavior.

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) String Uses

func (kind Kind) String() string

type Result Uses

type Result struct {
    // contains filtered or unexported fields

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.

func (*Result) Kind Uses

func (r *Result) Kind(fn *types.Func) Kind

Kind reports whether fn behaves like fmt.Print or fmt.Printf.

Package printf imports 17 packages (graph) and is imported by 14 packages. Updated 2020-12-01. Refresh now. Tools for package owners.