go-spew

A deep pretty printer for Go data structures with full type, pointer, and cycle-safe debug output.

Library
Go
vv1.1.1
6,410stars
ISC

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
41/100Fair
Development Activity0
Maintenance0
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture80
Code Quality85
Innovation65
Learning Curve65

go-spew is a small Go library for producing detailed, readable dumps of arbitrary in-memory data structures. Where the standard fmt package hides unexported fields, elides pointer chains, and doesn’t guard against cycles, go-spew walks every value with reflection, prints types and pointer addresses at every level, and safely detects circular references it has already visited.

It ships as both a standalone dumper (spew.Dump, spew.Sdump, spew.Fdump) and a set of drop-in wrappers around fmt’s Print/Printf family (spew.Printf, spew.Sprintf, spew.Errorf, and more) that substitute a custom Formatter for each argument. Configuration is centralized in a ConfigState struct, so indentation, depth limits, pointer-address visibility, and method-invocation behavior can be tuned globally or per call.

What You Get

  • Dump/Fdump/Sdump functions for full multi-line, indented dumps with type and pointer information
  • Printf/Sprintf/Fprintf-style wrappers that substitute go-spew formatting into any fmt call
  • A ConfigState struct for tuning indent, MaxDepth, pointer visibility, and method invocation, globally or per instance
  • Automatic circular-reference detection that prevents infinite recursion on self-referential structs
  • Hexdump-style output for byte slices and arrays, matching hexdump -C

Common Use Cases

  • Debugging nested structs, maps, and slices during local development
  • Printing readable failure diffs in unit tests, often paired with testify
  • Inspecting unexported struct fields without writing custom String() methods
  • Diagnosing corrupted or unexpected data shapes in application log output
  • Comparing two data structures visually when debugging serialization bugs

Under The Hood

Architecture go-spew is organized as a single flat package (spew) that separates the dumping engine (dump.go, dumpState) from the fmt-wrapper formatting layer (format.go, spew.go), sharing constant byte-slice literals and low-level value printers defined in common.go; a ConfigState struct in config.go centralizes every behavior tunable, and both entry points construct a fresh dumpState/formatState against it rather than mutating global state, so each call is independent and safe for concurrent use. Circular-reference detection is handled with a pointer-address-to-depth map threaded through the recursive dump() walker, and the unsafe-vs-safe split (bypass.go / bypasssafe.go) is resolved entirely at compile time via build tags, giving one clean call site (unsafeReflectValue) regardless of platform.

Tech Stack The package has zero third-party dependencies, relying only on Go’s standard library (reflect, unsafe, fmt, bytes, encoding/hex, regexp, sort, strconv, io, os). No go.mod is checked in, since the code predates Go modules; its own build-tag comments target compatibility back to go1.4, with special handling for environments where unsafe isn’t available, such as Google App Engine and GopherJS. CI (.travis.yml) runs gometalinter (gofmt, golint, vet, gosimple, unconvert) plus go test -race across Go 1.6 through tip, uploading coverage to Coveralls.

Code Quality The package ships nine test files whose combined size exceeds the implementation code, and the repo’s own test_coverage.txt documents effectively complete coverage of dump.go, format.go, and common.go; CI enforces this with race-detector runs, a coverage upload, and a linter gate that fails the build on any gofmt/golint/vet/gosimple deviation. Error handling is intentionally minimal, since this is a pure formatter with almost nothing that can fail; the one real risk, a panic inside a caller’s Stringer or error method, is explicitly caught with catchPanic/recover in common.go rather than left to propagate. Naming and structure follow idiomatic stdlib-style Go, with unexported byte-slice constants used in place of string literals to avoid allocation overhead.

What Makes It Unique go-spew’s defining technical choice is using the unsafe package to read reflect.Value’s private flag bits, bypassing Go’s visibility restrictions so it can print unexported struct fields and invoke pointer-receiver Stringer/error methods that reflection alone can’t reach. It pairs this with explicit pointer-address cycle detection so arbitrarily self-referential graphs never blow the stack, plus a hexdump-style renderer for byte slices. None of these ideas are unique in isolation, but the combination of safe unsafe-package use, full cycle safety, and a fmt-drop-in API made go-spew the de facto standard debug and test-diff dumper across the Go ecosystem, where it remains a near-ubiquitous transitive dependency despite little new capability being added in recent years.

Used by 8 apps in this directory

Go
75%
AGPL 3.0

Coder

Devops · Developer Tools · Code Editors

14,299

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
93
Repo Health
90
Technical
69
Dependency
Built with
Go75%
TypeScript23%
Updated today
Go
75%
MIT

Digger

Devops · Automation · Developer Tools

5,033

Run Terraform and OpenTofu natively inside your existing CI pipeline — no separate runners, no third-party secrets, no extra compute costs.

View details
71
Repo Health
73
Technical
67
Dependency
Built with
Go75%
TypeScript15%
Updated 2 weeks ago
Go
95%
MIT

Formance Ledger

Invoicing Finance · Developer Tools · Databases

1,368

The programmable open source core ledger for fintech — build money-moving applications with atomic multi-posting transactions, account-based modeling, and Numscript, a built-in DSL for financial logic.

View details
88
Repo Health
8
Technical
68
Dependency
Built with
Go95%
Updated 2 days ago
Go
98%
Apache 2.0

Nightingale

Monitoring

13,272

Open-source alerting engine that connects to any time-series or log data source and routes alarms to 20+ notification channels with AI-assisted triage.

View details
96
Repo Health
77
Technical
68
Dependency
Built with
Go98%
Updated today
Go
91%
Apache 2.0

Ory Kratos

Authentication

13,853

API-first identity and user management that handles login, registration, MFA, and recovery so your application never has to.

View details
84
Repo Health
78
Technical
67
Dependency
Built with
Go91%
Updated 1 months ago
Go
93%
MIT

Plandex

AI Code Assistants

15,598

An open-source, terminal-based AI coding agent built for large tasks and real codebases — with its own version control for plans, a 2M-token effective context window, and self-hosted or cloud deployment.

View details
49
Repo Health
70
Technical
68
Dependency
Built with
Go93%
Updated 11 months ago
Go
54%
AGPL 3.0

Uptrace

Monitoring · Devops

4,274

Unified open-source APM that collects OpenTelemetry traces, metrics, and logs into a single self-hosted platform backed by ClickHouse.

View details
63
Repo Health
70
Technical
66
Dependency
Built with
Go54%
Vue34%
Updated 2 weeks ago
Go
96%
BSD 3

Weaviate

Databases · Search

16,758

Open-source vector database combining semantic search, hybrid queries, RAG, and image search in a single cloud-native system built for production scale.

View details
91
Repo Health
85
Technical
70
Dependency
Built with
Go96%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search