errstack

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 16 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 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 returns 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 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 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 function is already in the list, returns 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