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

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

func (kind Kind) String() string

type Result

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

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

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

Package printf imports 18 packages (graph).

Version v0.1.8 (latest) | Published Dec 2, 2021 | Platform: linux/amd64 | Updated 3 weeks ago

Tools for package owners.