Go Code Analysis

Precise analysis of Go modules, microservice architectures, and infrastructure tooling

What Axiom Refract Analyzes in Go

Module and Package Resolution

Resolves Go module imports using go.mod and go.sum files. Maps the dependency graph across internal packages, standard library usage, and third-party module imports with version awareness.

Interface Satisfaction Analysis

Go interfaces are implicitly satisfied — a type implements an interface by having the right methods, not by declaring it. Axiom detects implicit interface satisfaction and maps the type-to-interface dependency graph.

Goroutine and Channel Flow

Traces goroutine spawn points and channel communication patterns. Identifies architectural patterns in concurrent Go code including fan-out/fan-in, worker pools, and pipeline stages.

Struct Embedding and Composition

Maps struct embedding hierarchies and method promotion chains. Identifies where embedded struct changes would cascade through composed types.

How It Works

Go is parsed using a hand-hardened Tree-sitter grammar supporting Go 1.18+ syntax, including generics (type parameters), the any constraint, and type inference for generic functions. The parser resolves package imports using the go.mod module path and handles internal package visibility rules. Build tag constraints are detected and files with build tags are annotated with their target platform.

Common Findings in Go Codebases

Package Cycle Detection

Go's compiler forbids circular package imports, but near-cycles through indirect dependencies create fragility. Axiom identifies dependency chains where adding one import would create a cycle.

Interface Pollution

Go codebases sometimes define interfaces in consumer packages that duplicate standard library or third-party interfaces. Axiom identifies redundant interface definitions and their structural impact.

Internal Package Boundary Violations

Go's internal package convention restricts import visibility, but the boundary is often placed incorrectly. Axiom validates internal package usage and identifies potential boundary violations.

Main Package Coupling

Go binaries sometimes place business logic in main packages rather than importable libraries. Axiom identifies main packages with high complexity that should be refactored into library packages.

Polyglot Support

Go is one of 145+ languages Axiom Refract supports through Tree-sitter AST parsing. Go analysis covers go.mod, go.sum, vendor directories, Makefile targets, Dockerfile multi-stage builds, and Go workspace files (go.work). Build constraint tags for platform-specific code are detected and annotated. Your entire codebase is analyzed in a single scan — regardless of how many languages it contains.

Analyze your Go codebase.