Documentation
¶
Overview ¶
Package analyzer provides static analysis capabilities for Go source code.
Index ¶
- type BinaryUsage
- type GoAnalyzer
- func (a *GoAnalyzer) Analyze(projectPath string) ([]rules.Finding, error)
- func (a *GoAnalyzer) AnalyzeBuildTags(filePath string) ([]rules.Finding, error)
- func (a *GoAnalyzer) AnalyzeDependencies(projectPath string) ([]rules.Finding, error)
- func (a *GoAnalyzer) GetBinarySummary() []rules.Finding
- func (a *GoAnalyzer) GetDetectedBinaries() map[string][]BinaryUsage
- type PackageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryUsage ¶
type BinaryUsage struct {
Binary string
Args []string
File string
Line int
Column int
IsShell bool
ShellCmd string // The full shell command if this binary was found inside a shell -c command
ShellBinaries []string // Other binaries used in the same shell command
}
BinaryUsage represents a usage of an external binary in the code.
type GoAnalyzer ¶
type GoAnalyzer struct {
// contains filtered or unexported fields
}
GoAnalyzer analyzes Go source code for container compatibility issues.
func (*GoAnalyzer) Analyze ¶
func (a *GoAnalyzer) Analyze(projectPath string) ([]rules.Finding, error)
Analyze analyzes Go source code in the given directory.
func (*GoAnalyzer) AnalyzeBuildTags ¶
func (a *GoAnalyzer) AnalyzeBuildTags(filePath string) ([]rules.Finding, error)
AnalyzeBuildTags checks for CGO-related build tags.
func (*GoAnalyzer) AnalyzeDependencies ¶
func (a *GoAnalyzer) AnalyzeDependencies(projectPath string) ([]rules.Finding, error)
AnalyzeDependencies dynamically analyzes all dependencies of a Go project to detect CGO usage, C files, and other compatibility issues.
func (*GoAnalyzer) GetBinarySummary ¶
func (a *GoAnalyzer) GetBinarySummary() []rules.Finding
GetBinarySummary returns a summary of all detected binaries with all their usage locations clubbed together.
func (*GoAnalyzer) GetDetectedBinaries ¶
func (a *GoAnalyzer) GetDetectedBinaries() map[string][]BinaryUsage
GetDetectedBinaries returns all binaries detected during analysis.
type PackageInfo ¶
type PackageInfo struct {
ImportPath string `json:"ImportPath"`
Name string `json:"Name"`
CgoFiles []string `json:"CgoFiles"`
CFiles []string `json:"CFiles"`
Deps []string `json:"Deps"`
Standard bool `json:"Standard"`
}
PackageInfo holds information about a Go package from go list.