Documentation
¶
Overview ¶
Package inspect provides deterministic codebase inspection functionality.
Package inspect provides deterministic codebase inspection functionality.
Package inspect provides deterministic codebase inspection functionality.
Package inspect provides deterministic codebase inspection functionality.
Index ¶
- func GetAllSourceFiles(dir string) ([]string, error)
- func GetSourceFiles(dir string) ([]string, error)
- func ReadSourceFile(baseDir, path string) (string, error)
- func ReadSourceFiles(baseDir string, paths []string) (map[string]string, error)
- type ExportedInterface
- type ExportedType
- type InterfaceMethod
- type ModFile
- type PackageInfo
- type Replace
- type Require
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllSourceFiles ¶
GetAllSourceFiles returns all Go source files (including test files) in a directory.
func GetSourceFiles ¶
GetSourceFiles returns a list of Go source files in a directory (excluding test files).
func ReadSourceFile ¶
ReadSourceFile reads a Go source file and returns its contents. The path is validated to ensure it's within the base directory. #nosec G304 - Path is validated via validatePath to ensure it's within baseDir
Types ¶
type ExportedInterface ¶
type ExportedInterface struct {
Name string
Doc string
Methods []InterfaceMethod
}
ExportedInterface represents an exported interface in a package.
func ExtractInterfaces ¶
func ExtractInterfaces(dir string) ([]ExportedInterface, error)
ExtractInterfaces extracts all exported interfaces from a package directory using go/packages.
type ExportedType ¶
type ExportedType struct {
Name string
Doc string
TypeKind string // "struct", "interface", "type alias", etc.
}
ExportedType represents an exported type in a package.
func ExtractTypes ¶
func ExtractTypes(dir string) ([]ExportedType, error)
ExtractTypes extracts all exported types from a package directory using go/packages.
type InterfaceMethod ¶
InterfaceMethod represents a method in an interface.
type ModFile ¶
ModFile represents a parsed go.mod file.
func ParseGoMod ¶
ParseGoMod parses a go.mod file and returns its contents as a ModFile struct. The path is validated to ensure it's within the base directory. #nosec G304 - Path is validated via validatePath to ensure it's within baseDir
func ParseModContent ¶
ParseModContent parses go.mod content from a string.
type PackageInfo ¶
PackageInfo represents information about a Go package.
func ListPackages ¶
func ListPackages(patterns ...string) ([]PackageInfo, error)
ListPackages runs `go list` and returns information about packages.
func ListPackagesInDir ¶
func ListPackagesInDir(dir string, patterns ...string) ([]PackageInfo, error)
ListPackagesInDir runs `go list` in a specific directory.