Documentation
¶
Index ¶
- func BuildGoPackageExportIndices(dirToFiles map[string][]string, contentReader vcs.ContentReader) map[string]GoPackageExportIndex
- func BuildIntraPackageDependencies(filePaths []string, contentReader vcs.ContentReader) (map[string][]string, error)
- func GetUsedSymbolsFromPackage(exportInfo *GoExportInfo, importPath string) map[string]bool
- func IsTestFile(filePath string) bool
- func ResolveGoProjectImports(absPath string, filePath string, dirToFiles map[string][]string, ...) ([]string, error)
- type ExternalImport
- type GoEmbed
- type GoExportInfo
- type GoImport
- type GoPackageExportIndex
- type GoSymbolInfo
- type InternalImport
- type Module
- type ProjectImportResolver
- type StandardLibraryImport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildGoPackageExportIndices ¶
func BuildGoPackageExportIndices(dirToFiles map[string][]string, contentReader vcs.ContentReader) map[string]GoPackageExportIndex
func BuildIntraPackageDependencies ¶
func BuildIntraPackageDependencies(filePaths []string, contentReader vcs.ContentReader) (map[string][]string, error)
BuildIntraPackageDependencies builds dependencies between files in the same Go package. The contentReader function is used to read file contents, allowing the caller to control whether files are read from the filesystem, a git commit, or another source.
func GetUsedSymbolsFromPackage ¶
func GetUsedSymbolsFromPackage(exportInfo *GoExportInfo, importPath string) map[string]bool
GetUsedSymbolsFromPackage extracts which symbols from a specific import path are actually used
func IsTestFile ¶
IsTestFile reports whether the given Go file path is a test file.
func ResolveGoProjectImports ¶
Types ¶
type ExternalImport ¶
type ExternalImport struct {
// contains filtered or unexported fields
}
ExternalImport represents an external module import
func (ExternalImport) Path ¶
func (e ExternalImport) Path() string
type GoEmbed ¶
type GoEmbed struct {
Pattern string // The embed pattern (file path or glob)
}
GoEmbed represents an embedded file from a //go:embed directive
func ParseGoEmbeds ¶
ParseGoEmbeds parses Go source code and extracts //go:embed directives
type GoExportInfo ¶
type GoExportInfo struct {
FilePath string
Package string
Exports map[string]bool // Exported symbols (capitalized) defined in this file
ImportAliases map[string]string // Maps import path to alias used (or package name if no alias)
DotImports map[string]bool // Tracks import paths imported via dot import
QualifiedRefs map[string]map[string]bool // Maps package alias -> set of symbols accessed
UnqualRefs map[string]bool // Unqualified refs, used for dot-import symbol filtering
}
GoExportInfo tracks exported symbols and import usage in a Go file
func ExtractGoExportInfo ¶
func ExtractGoExportInfo(filePath string) (*GoExportInfo, error)
ExtractGoExportInfo analyzes a Go file and extracts exported symbols and import usage
func ExtractGoExportInfoFromContent ¶
func ExtractGoExportInfoFromContent(filePath string, content []byte) (*GoExportInfo, error)
ExtractGoExportInfoFromContent analyzes Go source code and extracts exported symbols and import usage
type GoImport ¶
type GoImport interface {
Path() string
}
GoImport represents an import in a Go file
func ParseGoImports ¶
ParseGoImports parses Go source code and extracts imports
type GoPackageExportIndex ¶
GoPackageExportIndex maps exported symbols to their defining files within a package directory
func BuildPackageExportIndex ¶
func BuildPackageExportIndex(filePaths []string, contentReader vcs.ContentReader) (GoPackageExportIndex, error)
BuildPackageExportIndex builds an index of exported symbols for files in a package directory. The contentReader function is used to read file contents, allowing the caller to control whether files are read from the filesystem, a git commit, or another source.
type GoSymbolInfo ¶
type GoSymbolInfo struct {
FilePath string
Package string
Defined map[string]bool // Symbols defined in this file
Referenced map[string]bool // Symbols referenced in this file
}
GoSymbolInfo tracks symbols defined and referenced in a Go file
func ExtractGoSymbols ¶
func ExtractGoSymbols(filePath string) (*GoSymbolInfo, error)
ExtractGoSymbols analyzes a Go file and extracts defined and referenced symbols
func ExtractGoSymbolsFromContent ¶
func ExtractGoSymbolsFromContent(filePath string, content []byte) (*GoSymbolInfo, error)
ExtractGoSymbolsFromContent analyzes Go source code and extracts defined and referenced symbols
type InternalImport ¶
type InternalImport struct {
// contains filtered or unexported fields
}
InternalImport represents an internal project import
func (InternalImport) Path ¶
func (i InternalImport) Path() string
type Module ¶
type Module struct{}
func (Module) Extensions ¶
func (Module) IsTestFile ¶
func (Module) IsTestFile(filePath string, _ vcs.ContentReader) bool
func (Module) Maturity ¶
func (Module) Maturity() langsupport.MaturityLevel
func (Module) NewResolver ¶
func (Module) NewResolver(ctx *langsupport.Context, contentReader vcs.ContentReader) langsupport.Resolver
type ProjectImportResolver ¶
type ProjectImportResolver struct {
// contains filtered or unexported fields
}
ProjectImportResolver encapsulates Go-specific dependency resolution caches and logic.
func NewProjectImportResolver ¶
func NewProjectImportResolver( dirToFiles map[string][]string, suppliedFiles map[string]bool, contentReader vcs.ContentReader, ) *ProjectImportResolver
NewProjectImportResolver creates a Go dependency resolver with precomputed package export indices.
func (*ProjectImportResolver) ResolveProjectImports ¶
func (r *ProjectImportResolver) ResolveProjectImports(absPath, filePath string) ([]string, error)
ResolveProjectImports resolves Go project imports for a single file using cached indices.
type StandardLibraryImport ¶
type StandardLibraryImport struct {
// contains filtered or unexported fields
}
StandardLibraryImport represents a Go standard library import
func (StandardLibraryImport) Path ¶
func (s StandardLibraryImport) Path() string