-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.go
51 lines (37 loc) · 2.07 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package readgo
import "context"
// Validator defines the interface for validating Go code
type Validator interface {
// ValidateFile validates a specific Go source file
ValidateFile(ctx context.Context, filePath string) (*ValidationResult, error)
// ValidatePackage validates a Go package
ValidatePackage(ctx context.Context, pkgPath string) (*ValidationResult, error)
// ValidateProject validates the entire project
ValidateProject(ctx context.Context) (*ValidationResult, error)
}
// SourceReader defines the interface for reading Go source code
type SourceReader interface {
// GetFileTree returns the file tree starting from the given root
GetFileTree(ctx context.Context, root string, opts TreeOptions) (*FileTreeNode, error)
// ReadSourceFile reads a source file with the specified options
ReadSourceFile(ctx context.Context, path string, opts ReadOptions) ([]byte, error)
// GetPackageFiles returns all files in a package
GetPackageFiles(ctx context.Context, pkgPath string, opts TreeOptions) ([]*FileTreeNode, error)
// SearchFiles searches for files matching the given pattern
SearchFiles(ctx context.Context, pattern string, opts TreeOptions) ([]*FileTreeNode, error)
}
// CodeAnalyzer defines the interface for analyzing Go code
type CodeAnalyzer interface {
// FindType finds a specific type in the given package
FindType(ctx context.Context, pkgPath, typeName string) (*TypeInfo, error)
// FindInterface finds a specific interface in the given package
FindInterface(ctx context.Context, pkgPath, interfaceName string) (*TypeInfo, error)
// FindFunction finds a specific function in the given package
FindFunction(ctx context.Context, pkgPath, funcName string) (*TypeInfo, error)
// AnalyzeFile analyzes a specific Go source file
AnalyzeFile(ctx context.Context, filePath string) (*AnalysisResult, error)
// AnalyzePackage analyzes a Go package
AnalyzePackage(ctx context.Context, pkgPath string) (*AnalysisResult, error)
// AnalyzeProject analyzes a Go project at the specified path
AnalyzeProject(ctx context.Context, projectPath string) (*AnalysisResult, error)
}