errstack

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:       "errstack",
	Doc:        _doc,
	Run:        helpers.WrapRun(run),
	ResultType: reflect.TypeOf((*helpers.Result[*Result])(nil)),
	Requires:   []*analysis.Analyzer{inspect.Analyzer, ctrlflow.Analyzer, config.Analyzer, preload_packages.Analyzer},
}

Functions

This section is empty.

Types

type FunctionWithDepth added in v0.4.0

type FunctionWithDepth struct {
	Function *model.Function
	Depth    int
}

type Result

type Result struct {
	OriginalFunctions   []*model.Function
	FunctionsWithErrors map[token.Position]*model.Function
	// contains filtered or unexported fields
}

func (*Result) AnalyzeOriginalFunctions

func (res *Result) AnalyzeOriginalFunctions(pass *analysis.Pass)

AnalyzeOriginalFunctions walks over originally found functions CFG and reports if unnecessary wrapping is used.

func (*Result) FindFunctionsWithErrors

func (res *Result) FindFunctionsWithErrors(pass *analysis.Pass)

FindFunctionsWithErrors finds all functions that return errors in the AST.

func (*Result) MarkTaintedFunctions

func (res *Result) MarkTaintedFunctions()

MarkTaintedFunctions marks functions that return wrapped errors.

func (*Result) TryAddCallExpr

func (res *Result) TryAddCallExpr(info *model.Info, cfgs *ctrlflow.CFGs, call ast.Node) *model.Function

TryAddCallExpr tries to parse an AST node as a function call and add its decl to the list of functions with errors. Returns the position of the function declaration if it was added successfully, nil otherwise.

func (*Result) TryAddFunction

func (res *Result) TryAddFunction(info *model.Info, cfgs *ctrlflow.CFGs, fun any) *model.Function

TryAddFunction tries to parse an AST node as a function and add it to the list of functions with errors. Returns the position of the function declaration if it was added successfully, nil otherwise. If a function is already in the list, it returns the existing position.

type StackCall

type StackCall struct {
	Fn   *model.Function
	Call *ast.CallExpr
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL