Back to

Package printf

Latest Go to latest

The latest major version is .

Published: Sep 16, 2020 | License: BSD-3-Clause | Module:


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



const Doc = "" /* 1032 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 Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier