Documentation
¶
Overview ¶
Package playground serves the gIR Playground: a local web UI that shows what a frontend lowered a project to, and what the loaded rules make of it.
Its reason to exist is that both halves of a rule are invisible from source. A rule matches a canonical name and pins an injection point by LOGICAL argument index (`go:*gorm*.DB*.Raw#0`), where a statically-resolved method call carries its receiver as args[0] — so the index a rule pins is one less than the array index, and getting it wrong fails silently, selecting a real argument that is simply not the intended one.
Two rules keep this tool honest, and both are structural:
- Nothing here re-implements matching. Sink/source classification and the pattern tester both go through internal/rules, so what the UI draws is the engine's verdict. A second matcher that agreed today would drift.
- One scan per invocation. The program is lowered once by internal/scan and then only read, so what is on screen is what the command saw.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is the whole served state: one lowered program, indexed by source file.
func NewIndex ¶
NewIndex indexes a completed scan for serving. target is the path the user asked for; res.Program is the merged gIR, which internal/scan already retains.
func (*Index) Handler ¶
Handler returns the routed mux, so a test can drive the API with httptest instead of a listener.