Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultWrapperFunctions = []PkgFunctions{ {Pkg: "github.com/pkg/errors", Names: []string{ "New", "Errorf", "Wrap", "Wrapf", "WithStack", }}, } DefaultCleanFunctions = []PkgFunctions{ {Pkg: "github.com/pkg/errors", Names: []string{ "WithMessage", "WithMessagef", }}, {Pkg: "errors", Names: []string{ "New", "Wrapf", "WithStack", }}, {Pkg: "fmt", Names: []string{ "Errorf", }}, } )
Functions ¶
func NewAnalyzer ¶
Types ¶
type Config ¶ added in v0.0.3
type Config struct {
// WrapperFunctions - list of functions that are considered to wrap errors.
// If you're using some fancy error wrapping library like github.com/pkg/errors,
// you may want to add it to this list.
// If you want to ignore some functions, simply don't add them to the list.
WrapperFunctions []PkgFunctions `mapstructure:"wrapperFunctions" yaml:"wrapperFunctions"`
// CleanFunctions - list of functions that are considered to clean errors without stacktrace.
CleanFunctions []PkgFunctions `mapstructure:"cleanFunctions" yaml:"cleanFunctions"`
}
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type ErrStack ¶
type ErrStack struct {
// contains filtered or unexported fields
}
func NewErrStack ¶
type Function ¶ added in v0.1.0
type Function struct {
Name string // Name of the function
Node ast.Node // AST node of the function
Block *cfg.Block // Control flow graph of the function
Pos token.Position // Position of the function declaration
IsWrapping bool // Is true if this function returns wrapped errors
CalledBy *List[token.Position] // Functions that call this function
Pkg string // Package containing the function
Pass *Pass // Pass used to load the function
}
type List ¶ added in v0.1.0
type List[T comparable] struct { // contains filtered or unexported fields }
func NewList ¶ added in v0.1.0
func NewList[T comparable](length, capacity int) *List[T]
type Locked ¶ added in v0.1.0
type Locked[T any] struct { // contains filtered or unexported fields }
type Map ¶ added in v0.1.0
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
type Pass ¶ added in v0.1.0
type PkgFunctions ¶ added in v0.1.0
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) GetLoadMode ¶
type Settings ¶
type Settings struct {
WrappedFunctions []PkgFunctions
CleanFunctions []PkgFunctions
GoRoot string
WorkDir string
}
Click to show internal directories.
Click to hide internal directories.