Documentation
¶
Overview ¶
Package lint provides the foundation for tools like gosimple.
Index ¶
- func IsBlank(id ast.Expr) bool
- func IsGoVersion(version string) bool
- func IsIdent(expr ast.Expr, ident string) bool
- func IsZero(expr ast.Expr) bool
- type ByPosition
- type Checker
- type File
- func (f *File) BoolConst(expr ast.Expr) bool
- func (f *File) EnclosingSSAFunction(node Positioner) *ssa.Function
- func (f *File) Errorf(n Positioner, format string, args ...interface{}) *Problem
- func (f *File) ExprToInt(expr ast.Expr) (int64, bool)
- func (f *File) ExprToString(expr ast.Expr) (string, bool)
- func (f *File) IsBoolConst(expr ast.Expr) bool
- func (f *File) IsFunctionCallName(node ast.Node, name string) bool
- func (f *File) IsFunctionCallNameAny(node ast.Node, names ...string) bool
- func (f *File) IsGenerated() bool
- func (f *File) IsMain() bool
- func (f *File) IsNil(expr ast.Expr) bool
- func (f *File) IsTest() bool
- func (f *File) Render(x interface{}) string
- func (f *File) RenderArgs(args []ast.Expr) string
- func (f *File) Source() []byte
- func (f *File) Walk(fn func(ast.Node) bool)
- type Func
- type Ignore
- type Linter
- type Pkg
- type Positioner
- type Problem
- type Program
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBlank ¶
isBlank returns whether id is the blank identifier "_". If id == nil, the answer is false.
func IsGoVersion ¶
Types ¶
type ByPosition ¶
type ByPosition []Problem
func (ByPosition) Len ¶
func (p ByPosition) Len() int
func (ByPosition) Less ¶
func (p ByPosition) Less(i, j int) bool
func (ByPosition) Swap ¶
func (p ByPosition) Swap(i, j int)
type File ¶
type File struct {
Pkg *Pkg
File *ast.File
Filename string
Fset *token.FileSet
Program *loader.Program
// contains filtered or unexported fields
}
file represents a file being linted.
func (*File) EnclosingSSAFunction ¶
func (f *File) EnclosingSSAFunction(node Positioner) *ssa.Function
func (*File) Errorf ¶
func (f *File) Errorf(n Positioner, format string, args ...interface{}) *Problem
func (*File) IsFunctionCallName ¶
func (*File) IsFunctionCallNameAny ¶
func (*File) IsGenerated ¶
type Pkg ¶
type Pkg struct {
TypesPkg *types.Package
TypesInfo types.Info
SSAPkg *ssa.Package
PkgInfo *loader.PackageInfo
// contains filtered or unexported fields
}
pkg represents a package being linted.
type Positioner ¶
type Problem ¶
type Problem struct {
Position token.Position // position in source file
Text string // the prose that describes the problem
// If the problem has a suggested fix (the minority case),
// ReplacementLine is a full replacement for the relevant line of the source file.
ReplacementLine string
}
Problem represents a problem in some source code.
Click to show internal directories.
Click to hide internal directories.