Documentation
¶
Index ¶
- Variables
- func New(opts ...Option) (*analysis.Analyzer, error)
- type Heuristic
- type Option
- func Join(opts ...Option) Option
- func WithHeuristics(heuristics ...Heuristic) Option
- func WithOverrideFile(file string) Option
- func WithOverrides(overrides map[result.ErrorType][]string) Option
- func WithTrace(trace *regexp.Regexp) Option
- func WithWrappers(wrappers map[result.WrapperType][]string) Option
Constants ¶
This section is empty.
Variables ¶
var Analyzer = func() *analysis.Analyzer { a, err := New() if err != nil { panic(err) } return a }()
Analyzer is a pre-configured *analysis.Analyzer for detecting error types in Go programs.
Functions ¶
Types ¶
type Heuristic ¶
type Heuristic uint8
Heuristic represents heuristic flags used to control various passes in the analysis process.
const ( // HeuristicOff turns off all heuristic passes. HeuristicOff Heuristic = iota // off // HeuristicVar represents a heuristic pass for variable declarations. HeuristicVar // var // HeuristicUsage represents a heuristic pass for general usage. HeuristicUsage // usage // HeuristicReceivers represents a heuristic pass for consistent method receivers. HeuristicReceivers // receivers )
type Option ¶
Option configures specific behavior of the detect analysis.Analyzer.
func Join ¶ added in v0.0.11
Join creates a new Option joining the provided Option values.
The result implements slog.LogValuer, so the following is evaluated lazily:
slog.LogAttrs(ctx, slog.LevelInfo, "settings", Join(opts...).LogAttr())
func WithHeuristics ¶
WithHeuristics is an Option to configure heuristic passes.
func WithOverrideFile ¶ added in v0.0.9
WithOverrideFile returns an Option that configures usage overrides by reading types from the specified file.
func WithOverrides ¶
WithOverrides returns an Option that applies the provided overrides mapping, allowing specific type names to be associated with custom error types.
func WithWrappers ¶ added in v0.0.10
func WithWrappers(wrappers map[result.WrapperType][]string) Option
WithWrappers returns an Option that applies the provided overrides mapping, allowing specific functions to be treated as a wrapper for standard function.