analyzer

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package analyzer provides static analysis capabilities for Go source code.

Index

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 NewGoAnalyzer

func NewGoAnalyzer() *GoAnalyzer

NewGoAnalyzer creates a new Go analyzer.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL