Documentation
¶
Overview ¶
Package shared provides common functionality for errutil analyzers.
Index ¶
- Constants
- func ErrorResultIndex(sig *types.Signature) int
- func FileForPos(pass *analysis.Pass, pos token.Pos) token.Pos
- func HasErrorResult(sig *types.Signature) bool
- func IsErrUtilCall(call *ssa.Call) bool
- func IsErrUtilWrapCall(call *ssa.Call) bool
- func IsErrorConstructor(call *ssa.Call) bool
- func MarkSuppressed(directives []*Directive, filePos token.Pos, fnLine, targetLine int) bool
- func ReportUnused(pass *analysis.Pass, directives []*Directive, message string)
- func WalkFunctions(ssaInfo *ssa.Package, srcFuncs []*ssa.Function, fn func(*ssa.Function))
- func WrapsErrorConstructor(call *ssa.Call) bool
- type Directive
Constants ¶
const ErrUtilPkg = "github.com/graxinc/errutil"
Variables ¶
This section is empty.
Functions ¶
func ErrorResultIndex ¶
ErrorResultIndex returns the index of the error result in the signature, or -1 if none.
func FileForPos ¶
FileForPos returns the file position for a given position.
func HasErrorResult ¶
HasErrorResult returns true if the signature has an error result.
func IsErrUtilCall ¶
IsErrUtilCall returns true if the call is to an errutil wrapping function.
func IsErrUtilWrapCall ¶
IsErrUtilWrapCall returns true if the call is to errutil.With/Wrap/Witht/Wrapt (not New).
func IsErrorConstructor ¶
IsErrorConstructor returns true if the call is errors.New or fmt.Errorf.
func MarkSuppressed ¶
MarkSuppressed checks if a diagnostic at the given position should be suppressed. Returns true if suppressed, and marks the directive as used.
func ReportUnused ¶
ReportUnused reports all unused directives.
func WalkFunctions ¶
WalkFunctions walks all functions in the SSA including anonymous functions.
func WrapsErrorConstructor ¶
WrapsErrorConstructor returns true if the errutil.With/Wrap call wraps errors.New or fmt.Errorf.