Documentation
¶
Overview ¶
Package golang provides a Go source parser for graph extraction.
Index ¶
- func UnwindSelector(expr *ast.SelectorExpr) (baseIdent *ast.Ident, chains []string)
- type Parser
- func (p *Parser) ExtractCalls(_ context.Context, path string) ([]*graph.Edge, error)
- func (p *Parser) ExtractControlFlow(_ context.Context, path string) ([]*graph.Edge, error)
- func (p *Parser) ParseFile(_ context.Context, path string) ([]*graph.Node, []*graph.Edge, error)
- func (p *Parser) SetModuleName(name string)
- func (p *Parser) SetRootPath(root string)
- type StructFieldInfo
- type StructInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnwindSelector ¶ added in v0.2.2
func UnwindSelector(expr *ast.SelectorExpr) (baseIdent *ast.Ident, chains []string)
UnwindSelector recursively unwinds a selector expression chain, returning the base identifier and the ordered chain of field/method names. Example: for a.b.c(), returns (ident("a"), ["b", "c"]).
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses Go source files into graph nodes and edges.
func (*Parser) ExtractCalls ¶
ExtractCalls extracts call graph edges from a Go source file.
func (*Parser) ExtractControlFlow ¶
ExtractControlFlow extracts control-flow ordered call edges from a Go source file.
func (*Parser) SetModuleName ¶ added in v0.1.8
SetModuleName sets the module name for internal package resolution.
func (*Parser) SetRootPath ¶ added in v0.2.2
SetRootPath sets the module root directory for computing canonical package paths. This ensures nodes are stored with module-relative paths (e.g., "cmd/server") instead of absolute filesystem paths.
type StructFieldInfo ¶ added in v0.2.2
type StructFieldInfo struct {
FieldName string // The name of the field
FieldType string // The resolved type name (short name, e.g., "WalletRepository")
}
StructFieldInfo holds the type information for a struct field.
type StructInfo ¶ added in v0.2.2
type StructInfo struct {
PkgPath string
Name string
Fields []StructFieldInfo
}
StructInfo holds type information for a parsed struct.