Help us shape the future of Go! Take the 2026 Go Developer Survey

diff

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package diff computes package/dependency/symbol/position diffs between two analyzer snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyDiff

type DependencyDiff struct {
	Package  string       `json:"Package"`
	DiffType Type         `json:"DiffType"`
	Symbols  []SymbolDiff `json:"Symbols"`
}

DependencyDiff represents a dependency edge diff between two packages.

func CouplingStats

func CouplingStats(prev, curr analyzer.PackageCouplingStats) []DependencyDiff

CouplingStats compares two PackageCouplingStats and returns dependency-level diffs.

type PackageDiff

type PackageDiff struct {
	Package     string           `json:"Package"`
	DiffType    Type             `json:"DiffType"` // Added/Removed/Unchanged at the package level
	InwardDiff  []DependencyDiff `json:"InwardDiff"`
	OutwardDiff []DependencyDiff `json:"OutwardDiff"`
}

PackageDiff represents the diff for a single package between two snapshots.

func AllPackages

func AllPackages(prev, curr []analyzer.Metrics) []PackageDiff

AllPackages compares two full snapshots (all packages across all languages) and returns diffs for every package that changed.

func PackageMetrics

func PackageMetrics(prev, curr *analyzer.Metrics) *PackageDiff

PackageMetrics compares two full Metrics snapshots for a single package. Either prev or curr may be nil (indicating the package was added or removed).

type PositionDiff

type PositionDiff struct {
	Position analyzer.Position `json:"Position"`
	DiffType Type              `json:"DiffType"`
}

PositionDiff represents a position-level diff.

func Positions

func Positions(prev, curr []analyzer.Position) []PositionDiff

Positions compares two position slices and returns position-level diffs. Positions are matched by file:line (columns are ignored for matching).

type SymbolDiff

type SymbolDiff struct {
	Name      string         `json:"Name"`
	DiffType  Type           `json:"DiffType"`
	PrevCount uint           `json:"PrevCount"`
	CurrCount uint           `json:"CurrCount"`
	Positions []PositionDiff `json:"Positions"`
}

SymbolDiff represents a symbol-level diff within a dependency edge.

func Symbols

func Symbols(prev, curr analyzer.CouplingStats) []SymbolDiff

Symbols compares two CouplingStats and returns symbol-level diffs.

type Type

type Type int

Type indicates whether an element was added, removed, or unchanged.

const (
	Unchanged Type = iota
	Added
	Removed
)

Diff kinds classify each element relative to the previous snapshot.

Jump to

Keyboard shortcuts

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