Documentation
¶
Overview ¶
Package astquery is a structural (AST-shape) search over Go source with metavariables — the "match code by shape, not text" seam (#3438, epic #3434). It is the semgrep/comby idea in miniature: a pattern is a fragment of Go with $NAME holes, and it matches any subtree of the same shape, binding each hole to the concrete node it lands on. A repeated hole must bind consistently, so `$X == $X` matches `a == a` but not `a == b` — the property a plain regex or the trigram index (#3437) cannot express.
Scope is expression patterns: the pattern parses as a Go expression, and every expression subtree of the target file is a candidate. That already covers the high-value queries (call shapes, comparisons, selector chains) and keeps the matcher a small, total tree-unification over the go/ast node types it knows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComparisonArm ¶ added in v0.44.0
type ComparisonArm struct {
Name string
Kind string
Available bool
Correct bool
Latency time.Duration
TruePositives int
FalsePositives int
FalseNegatives int
BindingErrors int
LocationErrors int
ParseFailures int
InputBytes int64
CPUSeconds float64
PeakRSSBytes int64
NetworkBytes int64
OperatorSeconds float64
CostUSD float64
Note string
}
type ComparisonResult ¶ added in v0.44.0
type ComparisonResult struct {
Workload string
Arms []ComparisonArm
}
func CompareLocal ¶ added in v0.44.0
func CompareLocal() ComparisonResult