Documentation
¶
Index ¶
- type PackageLoader
- type Parser
- func (*Parser) IsSemanticInput(path string) bool
- func (*Parser) Language() string
- func (p *Parser) Parse(ctx context.Context, input parserapi.Input) (graph.ParseResult, error)
- func (*Parser) SemanticAffectedPaths(root string, allPaths, changedPaths []string) []string
- func (*Parser) SemanticDependencies() []string
- func (p *Parser) SemanticKey(ctx context.Context, input parserapi.Input) (string, error)
- func (p *Parser) SemanticLoadMetrics() SemanticLoadMetrics
- func (*Parser) Supports(path string) bool
- func (*Parser) WorkspaceSemanticEvidenceKey(_ context.Context, input parserapi.Input) (string, error)
- func (p *Parser) WorkspaceSemanticKey(ctx context.Context, input parserapi.Input) (string, error)
- type SemanticCall
- type SemanticChiEndpoint
- type SemanticChiMiddleware
- type SemanticErrorDeclaration
- type SemanticErrorResult
- type SemanticFailure
- type SemanticFunction
- type SemanticHTTPRequest
- type SemanticImplementation
- type SemanticLoadMetrics
- type SemanticLoader
- type SemanticProtocolUse
- type SemanticServeMuxEndpoint
- type SemanticTransportUse
- type SemanticView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageLoader ¶
type PackageLoader struct {
// contains filtered or unexported fields
}
PackageLoader is the production go/packages adapter. A single load at a time bounds the large syntax/type graph, and cached entries retain compact views rather than package objects.
func NewPackageLoader ¶
func NewPackageLoader() *PackageLoader
func (*PackageLoader) Load ¶
func (l *PackageLoader) Load(ctx context.Context, input parserapi.Input) (SemanticView, error)
func (*PackageLoader) Metrics ¶
func (l *PackageLoader) Metrics() SemanticLoadMetrics
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewWithBindingLoader ¶
func NewWithBindingLoader(loader *protobufbinding.Loader) *Parser
func NewWithSemanticLoader ¶
func NewWithSemanticLoader(loader SemanticLoader) *Parser
func (*Parser) IsSemanticInput ¶
func (*Parser) SemanticAffectedPaths ¶
SemanticAffectedPaths reparses the Go files that can observe a changed file.
A module or vendor manifest, or a Protobuf binding input, changes the load plan for the whole repository and stays conservative. A Go source edit reaches its own package, because the statement-level analyzers walk it, and the package's transitive importers, because identifier resolution, promoted method sets, and constant folding read their dependencies' declarations.
This is the selection half of the narrowing described in semantic_model.go. The keys decide whether a visited file is reparsed, but a file the indexer never visits is never hashed, so narrowing the keys without widening selection here would retain stale facts in a package whose dependency changed. The two have to move together.
The model consulted is the one WorkspaceSemanticKey published for this root earlier in the same pass, so the import graph agrees with the keys. Without a published model the graph is unknown and every Go file is offered, which is what this function did unconditionally before the import graph existed.
func (*Parser) SemanticDependencies ¶
func (*Parser) SemanticKey ¶
SemanticKey refines WorkspaceSemanticKey with the package-local facts that change how this specific file extracts. Statement-level evidence is attributed to the highest package-local callsite, which may live in a sibling file of the same package, so every Go file shares one key per directory. A caller that already holds the workspace key passes it as Input.SemanticKey so the repository-wide digest is computed once per run.
func (*Parser) SemanticLoadMetrics ¶
func (p *Parser) SemanticLoadMetrics() SemanticLoadMetrics
func (*Parser) WorkspaceSemanticEvidenceKey ¶
func (*Parser) WorkspaceSemanticKey ¶
WorkspaceSemanticKey fingerprints only the Go facts that no import edge can bound: the build context, the module and vendor manifests, the Protobuf binding registry, and the repository's type universe. Everything else is reachable by imports and belongs to SemanticKey's package scope.
type SemanticCall ¶
type SemanticChiEndpoint ¶
type SemanticChiEndpoint struct {
Function string
FunctionKind graph.NodeKind
Method string
Route string
Handler string
HandlerKind graph.NodeKind
Location graph.Location
Middleware []SemanticChiMiddleware
Conditional bool
Unresolved bool
}
SemanticChiEndpoint is the final package-local composition of a Chi route. It deliberately retains no AST or types objects after package loading.
type SemanticChiMiddleware ¶
type SemanticChiMiddleware struct {
Target string
TargetKind graph.NodeKind
Form string
Location graph.Location
Unresolved bool
}
SemanticChiMiddleware is compact, go/types-backed evidence for one middleware inherited by a composed Chi endpoint.
type SemanticErrorResult ¶
type SemanticFailure ¶
type SemanticFailure struct {
Function string
Kind graph.EdgeKind
Target string
TargetKind graph.NodeKind
Location graph.Location
Properties map[string]string
}
SemanticFailure is compact, evidence-backed output from the Go failure extractor. Function maps back to the declaration node owned by the syntax parser; Target is a stable go/types identity or an explicit unresolved boundary.
type SemanticFunction ¶
type SemanticFunction struct {
ErrorResults []SemanticErrorResult
Promoted bool
}
type SemanticHTTPRequest ¶
type SemanticHTTPRequest struct {
Function string
FunctionKind graph.NodeKind
Method string
Route string
Sink string
Source string
Wrappers []string
Location graph.Location
AuthorityUnknown bool
Conditional bool
}
SemanticHTTPRequest is compact, go/types-backed evidence for one proven outbound request at its highest package-local application callsite.
type SemanticImplementation ¶
type SemanticLoadMetrics ¶
type SemanticLoadMetrics struct {
Loads int64
CacheHits int64
// PersistedHits counts workspace entries adopted from the cross-process view
// cache, and PersistedSaves the entries written to it.
PersistedHits int64
PersistedSaves int64
// PersistedDecodes counts the package segments decoded from an adopted
// entry, and PersistedSegmentWrites the segments re-encoded by a save. Both
// stay well below the package count on an incremental refresh: a run reads
// and rewrites the packages its edit touched, not the workspace.
PersistedDecodes int64
PersistedSegmentWrites int64
PeakConcurrent int64
LastDurationMS int64
}
type SemanticLoader ¶
SemanticLoader separates package/type loading from syntax extraction. Tests can supply compact evidence without invoking the Go toolchain.
type SemanticProtocolUse ¶
type SemanticProtocolUse struct {
Function string
Kind graph.EdgeKind
Binding string
Form string
API string
StaticType string
Location graph.Location
}
SemanticProtocolUse is compact go/types evidence for one possible protocol operation. Binding names a generated Go symbol; the parser maps it through the Protobuf binding registry before any canonical fact is emitted.
type SemanticServeMuxEndpoint ¶
type SemanticServeMuxEndpoint struct {
Function string
FunctionKind graph.NodeKind
Method string
Route string
Host string
Pattern string
Handler string
HandlerKind graph.NodeKind
Location graph.Location
Unresolved bool
}
SemanticServeMuxEndpoint is compact go/types-backed evidence for one standard-library net/http ServeMux registration.
type SemanticTransportUse ¶
type SemanticTransportUse struct {
Function string
Spec transport.Spec
Channel string
ChannelStatus string
Reliability string
PayloadStatus string
PayloadBinding string
WrapperDepth int
Location graph.Location
}
SemanticTransportUse is compact go/types-backed evidence for one exact ENet operation. PayloadBinding is a generated Go message identity when bounded data flow proves it; canonicalization remains the parser registry's job.
type SemanticView ¶
type SemanticView struct {
Available bool
Included bool
PackagePath string
ModulePath string
BuildContext string
Calls map[int]SemanticCall
ProtocolUses []SemanticProtocolUse
TransportUses []SemanticTransportUse
Implementations []SemanticImplementation
Functions map[string]SemanticFunction
ErrorDeclarations []SemanticErrorDeclaration
Failures []SemanticFailure
ChiEndpoints []SemanticChiEndpoint
ChiEndpointCalls map[int]bool
ServeMuxEndpoints []SemanticServeMuxEndpoint
ServeMuxEndpointCalls map[int]bool
NonChiHTTPCalls map[int]bool
HTTPRequests []SemanticHTTPRequest
HTTPRequestCalls map[int]bool
Diagnostics []graph.Diagnostic
}
SemanticView contains only the evidence needed while parsing one file. It deliberately does not retain go/ast or go/types graphs after loading.