analyzer

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package analyzer provides functionality for analyzing Go package dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer analyzes Go package dependencies.

func New

func New() *Analyzer

New creates a new analyzer.

func (*Analyzer) AnalyzeFromFile

func (a *Analyzer) AnalyzeFromFile(
	entryFile string,
	excludeExternal bool,
	excludeDirs []string,
) (*DependencyGraph, error)

AnalyzeFromFile analyzes package dependencies starting from a Go file.

func (*Analyzer) AnalyzeMultipleEntryPoints

func (a *Analyzer) AnalyzeMultipleEntryPoints(
	repoRoot string,
	excludeExternal bool,
	excludeDirs []string,
) (*MultiEntryAnalysisResult, error)

AnalyzeMultipleEntryPoints finds and analyzes all entry points in a repository.

func (*Analyzer) FindEntryPoints

func (a *Analyzer) FindEntryPoints(repoRoot string) ([]string, error)

FindEntryPoints scans a directory tree for Go files containing main functions.

type DependencyGraph

type DependencyGraph struct {
	EntryPackage string
	Packages     map[string]*PackageInfo
	Layers       [][]string // Packages organized by layer
	ModuleName   string     // Name of the Go module
}

DependencyGraph represents the package dependency graph.

type EntryPoint

type EntryPoint struct {
	Path         string           `json:"path"`         // Absolute file path
	RelativePath string           `json:"relativePath"` // Relative path from repository root
	PackagePath  string           `json:"packagePath"`  // Go package path
	DOTContent   string           `json:"dotContent"`   // Generated DOT visualization
	Graph        *DependencyGraph `json:"-"`            // Internal graph data (not serialized)
}

EntryPoint represents a detected entry point in the codebase.

type MultiEntryAnalysisResult

type MultiEntryAnalysisResult struct {
	Success     bool         `json:"success"`
	EntryPoints []EntryPoint `json:"entryPoints,omitempty"`
	Error       string       `json:"error,omitempty"`
	RepoRoot    string       `json:"repoRoot"`
	ModuleName  string       `json:"moduleName"`
}

MultiEntryAnalysisResult represents the result of analyzing multiple entry points.

type PackageInfo

type PackageInfo struct {
	Name         string
	Path         string
	Dependencies []string
	Layer        int // Layer in the dependency graph (0 = bottom layer)
	FileCount    int // Number of Go files in the package
}

PackageInfo represents information about a Go package.

Jump to

Keyboard shortcuts

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