package lintdsl
import "honnef.co/go/tools/lint/lintdsl"
Package lintdsl provides helpers for implementing static analysis checks. Dot-importing this package is encouraged.
Index ¶
- func BoolConst(pass *analysis.Pass, expr ast.Expr) bool
- func CallName(call *ssa.CallCommon) string
- func CallNameAST(pass *analysis.Pass, call *ast.CallExpr) string
- func Dereference(T types.Type) types.Type
- func DereferenceR(T types.Type) types.Type
- func ExprToInt(pass *analysis.Pass, expr ast.Expr) (int64, bool)
- func ExprToString(pass *analysis.Pass, expr ast.Expr) (string, bool)
- func File(pass *analysis.Pass, node lint.Positioner) *ast.File
- func FilterDebug(instr []ssa.Instruction) []ssa.Instruction
- func Generator(pass *analysis.Pass, pos token.Pos) (facts.Generator, bool)
- func GroupSpecs(fset *token.FileSet, specs []ast.Spec) [][]ast.Spec
- func Inspect(node ast.Node, fn func(node ast.Node) bool)
- func IsBlank(id ast.Expr) bool
- func IsBoolConst(pass *analysis.Pass, expr ast.Expr) bool
- func IsCallTo(call *ssa.CallCommon, name string) bool
- func IsCallToAST(pass *analysis.Pass, node ast.Node, name string) bool
- func IsCallToAnyAST(pass *analysis.Pass, node ast.Node, names ...string) bool
- func IsExample(fn *ssa.Function) bool
- func IsGenerated(pass *analysis.Pass, pos token.Pos) bool
- func IsGoVersion(pass *analysis.Pass, minor int) bool
- func IsIdent(expr ast.Expr, ident string) bool
- func IsInMain(pass *analysis.Pass, node lint.Positioner) bool
- func IsInTest(pass *analysis.Pass, node lint.Positioner) bool
- func IsIntLiteral(expr ast.Expr, literal string) bool
- func IsNil(pass *analysis.Pass, expr ast.Expr) bool
- func IsObject(obj types.Object, name string) bool
- func IsOfType(pass *analysis.Pass, expr ast.Expr, name string) bool
- func IsPointerLike(T types.Type) bool
- func IsType(T types.Type, name string) bool
- func IsZero(expr ast.Expr) bool
- func Preamble(f *ast.File) string
- func Render(pass *analysis.Pass, x interface{}) string
- func RenderArgs(pass *analysis.Pass, args []ast.Expr) string
- func ReportNodef(pass *analysis.Pass, node ast.Node, format string, args ...interface{})
- func ReportNodefFG(pass *analysis.Pass, node ast.Node, format string, args ...interface{})
- func ReportfFG(pass *analysis.Pass, pos token.Pos, f string, args ...interface{})
- func SelectorName(pass *analysis.Pass, expr *ast.SelectorExpr) string
- type Field
Functions ¶
func BoolConst ¶
func CallName ¶
func CallName(call *ssa.CallCommon) string
func CallNameAST ¶
func Dereference ¶
Dereference returns a pointer's element type; otherwise it returns T.
func DereferenceR ¶
DereferenceR returns a pointer's element type; otherwise it returns T. If the element type is itself a pointer, DereferenceR will be applied recursively.
func ExprToInt ¶
func ExprToString ¶
func File ¶
func FilterDebug ¶
func FilterDebug(instr []ssa.Instruction) []ssa.Instruction
func Generator ¶
Generator returns the generator that generated the file containing pos. It ignores //line directives.
func GroupSpecs ¶
func Inspect ¶
func IsBlank ¶
isBlank returns whether id is the blank identifier "_". If id == nil, the answer is false.
func IsBoolConst ¶
func IsCallTo ¶
func IsCallTo(call *ssa.CallCommon, name string) bool
func IsCallToAST ¶
func IsCallToAnyAST ¶
func IsExample ¶
func IsGenerated ¶
IsGenerated reports whether pos is in a generated file, It ignores //line directives.
func IsGoVersion ¶
func IsIdent ¶
func IsInMain ¶
func IsInMain(pass *analysis.Pass, node lint.Positioner) bool
func IsInTest ¶
func IsInTest(pass *analysis.Pass, node lint.Positioner) bool
func IsIntLiteral ¶
func IsNil ¶
func IsObject ¶
func IsOfType ¶
func IsPointerLike ¶
func IsType ¶
func IsZero ¶
Deprecated: use IsIntLiteral instead
func Preamble ¶
func Render ¶
func RenderArgs ¶
func ReportNodef ¶
func ReportNodefFG ¶
func ReportfFG ¶
func SelectorName ¶
func SelectorName(pass *analysis.Pass, expr *ast.SelectorExpr) string
Types ¶
type Field ¶
func FlattenFields ¶
FlattenFields recursively flattens T and embedded structs, returning a list of fields. If multiple fields with the same name exist, all will be returned.
Source Files ¶
lintdsl.go
- Version
- v0.0.1-2019.2.2
- Published
- Jul 29, 2019
- Platform
- js/wasm
- Imports
- 13 packages
- Last checked
- 4 minutes ago –
Tools for package owners.