arch

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package arch provides architectural structure analysis for Go projects.

Package arch provides architectural structure analysis for Go projects.

Package arch provides architectural structure analysis for Go projects.

Package arch provides architectural layer enforcement analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasCycleFor

func HasCycleFor(pkg string, cycles []ImportCycle) bool

HasCycleFor reports whether a specific package is part of any cycle.

Types

type DirectCallViolation

type DirectCallViolation struct {
	FromPkg   string // e.g. "handler"
	ToPkg     string // e.g. "repo"
	FuncName  string // e.g. "HandleLogin"
	CallSite  string // file:line
	TargetSym string // called symbol
}

DirectCallViolation represents a direct call between architecture layers.

func AnalyzeDirectCalls

func AnalyzeDirectCalls(pattern string) ([]DirectCallViolation, error)

AnalyzeDirectCalls detects direct layer violations such as handler → repo.

type GodStruct

type GodStruct struct {
	Name      string   // Struct name
	PkgPath   string   // Package path
	MethodNum int      // Total method count
	Methods   []string // List of method names
	Location  string   // Source file location
}

GodStruct represents a struct with excessive number of methods.

func AnalyzeGodStructs

func AnalyzeGodStructs(pattern string, methodLimit int) ([]GodStruct, error)

AnalyzeGodStructs scans for structs with too many methods.

type ImportCycle

type ImportCycle struct {
	Packages []string // Ordered list of packages in the cycle
}

ImportCycle represents a detected cycle between Go packages.

func AnalyzeImportCycles

func AnalyzeImportCycles(pattern string) ([]ImportCycle, error)

AnalyzeImportCycles analyzes all packages starting from the given pattern (e.g. "./...") and returns detected import cycles, if any.

type LayerViolation

type LayerViolation struct {
	FromPkg   string // e.g. "handler"
	ToPkg     string // e.g. "repo"
	FuncName  string // e.g. "HandleLogin"
	CallSite  string // file:line
	TargetSym string // full symbol name
}

LayerViolation represents a violation of architectural layer rules.

func AnalyzeLayering

func AnalyzeLayering(pattern string) ([]LayerViolation, error)

AnalyzeLayering inspects the project for improper layer dependencies.

Jump to

Keyboard shortcuts

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