Documentation
¶
Overview ¶
Package golang provides Go language extraction for knowledge graphs.
Package golang provides Go language extraction for knowledge graphs. This file implements semantic analysis using go/types for enhanced extraction.
Index ¶
- Constants
- type Extractor
- type SemanticExtractor
- func (e *SemanticExtractor) CanExtract(path string) bool
- func (e *SemanticExtractor) DetectFramework(path string) *provider.FrameworkInfo
- func (e *SemanticExtractor) Extensions() []string
- func (e *SemanticExtractor) ExtractFile(path, baseDir string) ([]*graph.Node, []*graph.Edge, error)
- func (e *SemanticExtractor) Language() string
- func (e *SemanticExtractor) LoadPackage(dir string) error
- type SemanticOption
Constants ¶
const ( // Language is the canonical name for Go. Language = "go" // NodePrefix is the prefix for all Go node IDs. NodePrefix = "go_" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor implements extract.LanguageExtractor for Go source code. It uses the native go/parser and go/ast packages for extraction.
func (*Extractor) CanExtract ¶
CanExtract returns true for .go files.
func (*Extractor) DetectFramework ¶
func (e *Extractor) DetectFramework(path string) *provider.FrameworkInfo
DetectFramework returns nil for Go (no framework detection yet).
func (*Extractor) Extensions ¶
Extensions returns Go file extensions.
func (*Extractor) ExtractFile ¶
ExtractFile extracts nodes and edges from a single Go file.
type SemanticExtractor ¶ added in v0.3.0
type SemanticExtractor struct {
// contains filtered or unexported fields
}
SemanticExtractor provides enhanced Go extraction with type information. It uses golang.org/x/tools/go/packages for full semantic analysis.
func NewSemanticExtractor ¶ added in v0.3.0
func NewSemanticExtractor(opts ...SemanticOption) *SemanticExtractor
NewSemanticExtractor creates a new semantic-aware Go extractor.
func (*SemanticExtractor) CanExtract ¶ added in v0.3.0
func (e *SemanticExtractor) CanExtract(path string) bool
CanExtract returns true for .go files.
func (*SemanticExtractor) DetectFramework ¶ added in v0.3.0
func (e *SemanticExtractor) DetectFramework(path string) *provider.FrameworkInfo
DetectFramework detects Go web frameworks.
func (*SemanticExtractor) Extensions ¶ added in v0.3.0
func (e *SemanticExtractor) Extensions() []string
Extensions returns Go file extensions.
func (*SemanticExtractor) ExtractFile ¶ added in v0.3.0
ExtractFile extracts nodes and edges from a single Go file with semantic analysis.
func (*SemanticExtractor) Language ¶ added in v0.3.0
func (e *SemanticExtractor) Language() string
Language returns "go".
func (*SemanticExtractor) LoadPackage ¶ added in v0.3.0
func (e *SemanticExtractor) LoadPackage(dir string) error
LoadPackage loads a Go package with full type information.
type SemanticOption ¶ added in v0.3.0
type SemanticOption func(*SemanticExtractor)
SemanticOption configures the SemanticExtractor.
func WithFrameworkDetection ¶ added in v0.3.0
func WithFrameworkDetection(enable bool) SemanticOption
WithFrameworkDetection enables framework detection.