Documentation
¶
Overview ¶
Package heuristics implements the built-in mem-guard checks. Each Heuristic inspects an analysis.Context and returns finding.Findings for patterns that may cause unbounded memory growth.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppendInLoop ¶
type AppendInLoop struct{}
AppendInLoop detects append() calls inside unbounded loop bodies.
func (*AppendInLoop) Description ¶
func (h *AppendInLoop) Description() string
func (*AppendInLoop) Name ¶
func (h *AppendInLoop) Name() string
type ChannelDrivenGrowth ¶
type ChannelDrivenGrowth struct{}
ChannelDrivenGrowth detects collecting from channels into growing data structures.
func (*ChannelDrivenGrowth) Check ¶
func (h *ChannelDrivenGrowth) Check(ctx *analysis.Context) []finding.Finding
func (*ChannelDrivenGrowth) Description ¶
func (h *ChannelDrivenGrowth) Description() string
func (*ChannelDrivenGrowth) Name ¶
func (h *ChannelDrivenGrowth) Name() string
type CrossBoundaryGrowth ¶
type CrossBoundaryGrowth struct{}
CrossBoundaryGrowth detects loops that call functions which grow passed-in collections via pointer or map reference.
func (*CrossBoundaryGrowth) Check ¶
func (h *CrossBoundaryGrowth) Check(ctx *analysis.Context) []finding.Finding
func (*CrossBoundaryGrowth) Description ¶
func (h *CrossBoundaryGrowth) Description() string
func (*CrossBoundaryGrowth) Name ¶
func (h *CrossBoundaryGrowth) Name() string
type GoroutineSpawnInLoop ¶
type GoroutineSpawnInLoop struct{}
GoroutineSpawnInLoop detects go statements inside unbounded loops.
func (*GoroutineSpawnInLoop) Check ¶
func (h *GoroutineSpawnInLoop) Check(ctx *analysis.Context) []finding.Finding
func (*GoroutineSpawnInLoop) Description ¶
func (h *GoroutineSpawnInLoop) Description() string
func (*GoroutineSpawnInLoop) Name ¶
func (h *GoroutineSpawnInLoop) Name() string
type Heuristic ¶
type Heuristic interface {
Name() string
Description() string
Check(ctx *analysis.Context) []finding.Finding
}
Heuristic defines the interface for a single analysis check.
type MapGrowInLoop ¶
type MapGrowInLoop struct{}
MapGrowInLoop detects map key assignments inside unbounded loop bodies.
func (*MapGrowInLoop) Check ¶
func (h *MapGrowInLoop) Check(ctx *analysis.Context) []finding.Finding
func (*MapGrowInLoop) Description ¶
func (h *MapGrowInLoop) Description() string
func (*MapGrowInLoop) Name ¶
func (h *MapGrowInLoop) Name() string
type RecursiveAccumulator ¶
type RecursiveAccumulator struct{}
RecursiveAccumulator detects recursive functions that grow a collection parameter without a visible depth limit.
func (*RecursiveAccumulator) Check ¶
func (h *RecursiveAccumulator) Check(ctx *analysis.Context) []finding.Finding
func (*RecursiveAccumulator) Description ¶
func (h *RecursiveAccumulator) Description() string
func (*RecursiveAccumulator) Name ¶
func (h *RecursiveAccumulator) Name() string
type UnboundedConcat ¶
type UnboundedConcat struct{}
UnboundedConcat detects string concatenation in unbounded loops.
func (*UnboundedConcat) Check ¶
func (h *UnboundedConcat) Check(ctx *analysis.Context) []finding.Finding
func (*UnboundedConcat) Description ¶
func (h *UnboundedConcat) Description() string
func (*UnboundedConcat) Name ¶
func (h *UnboundedConcat) Name() string