Functions
forbiddenMethod
function
#
forbiddenMethod decomposes a call x.m() into (x, x.m, m) where
x is a variable, x.m is a selection, and m is the static callee m.
Returns (nil, nil, nil) if call is not of this form.
func forbiddenMethod(info *types.Info, call *ast.CallExpr) (*types.Var, *types.Selection, *types.Func)
formatMethod
function
#
func formatMethod(sel *types.Selection, fn *types.Func) string
funcIdent
function
#
func funcIdent(fun ast.Expr) *ast.Ident
funcLitInScope
function
#
funcLitInScope returns a FuncLit that id is at least initially assigned to.
TODO: This is closely tied to id.Obj which is deprecated.
func funcLitInScope(id *ast.Ident) *ast.FuncLit
goAsyncCall
function
#
goAsyncCall returns the extent of a call from a go fun() statement.
func goAsyncCall(info *types.Info, goStmt *ast.GoStmt, toDecl func(*types.Func) *ast.FuncDecl) *asyncCall
hasBenchmarkOrTestParams
function
#
func hasBenchmarkOrTestParams(fnDecl *ast.FuncDecl) bool
init
function
#
func init()
isMethodNamed
function
#
isMethodNamed returns true if f is a method defined
in package with the path pkgPath with a name in names.
func isMethodNamed(f *types.Func, pkgPath string, names ...string) bool
localFunctionDecls
function
#
localFunctionDecls returns a mapping from *types.Func to *ast.FuncDecl in files.
func localFunctionDecls(info *types.Info, files []*ast.File) (func(*types.Func) *ast.FuncDecl)
run
function
#
func run(pass *analysis.Pass) (interface{}, error)
tRunAsyncCall
function
#
tRunAsyncCall returns the extent of a call from a t.Run("name", fun) expression.
func tRunAsyncCall(info *types.Info, call *ast.CallExpr) *asyncCall
typeIsTestingDotTOrB
function
#
func typeIsTestingDotTOrB(expr ast.Expr) (string, bool)
withinScope
function
#
withinScope returns true if x.Pos() is in [scope.Pos(), scope.End()].
func withinScope(scope ast.Node, x *types.Var) bool