# sanity-io/litter

Litter is a pretty printer library for Go data structures to aid in debugging and testing.

Repository: https://github.com/sanity-io/litter
Canonical: https://ross.abutalabs.com/products/sanity-io-litter
Language: Go
License: MIT
License Family: permissive
Topics: golang, go, testing, logging, library, mit-license
Last push: 2026-05-04T10:47:31+00:00

## Health v2 (maintenance only)
Score: 68/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 80, release rhythm 35, longevity 100
- inputs: {"age_days": 3453, "days_push": 121, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1656, forks 60 (observed 2026-08-28T04:05:18.005325+00:00)

## What it is
Litter is a Go library that pretty-prints data structures as syntactically valid Go literals for debugging and testing. It produces consistent, sorted output suitable for snapshot comparisons in unit tests and handles circular references with aliases.

## Use cases
- dump Go data structures for debugging
- snapshot testing in Go unit tests
- print structs as valid Go literals
- compare test output against saved expected data
- inspect circular references and aliased pointers
- alternative to JSON/YAML for readable test fixtures

## When to choose
- you need readable, terse dumps of Go values during debugging
- you want deterministic snapshot output for unit tests
- you need output that is valid Go code
- you have circular or aliased references to visualize

## When to avoid
- you need machine-parseable output like JSON or YAML
- you are not working in Go
- you need colored or interactive debugging tools

## Facets
- artifact type: library
- maturity: stable
- function: testing, logging, serialization, developer-tools
- domain: developer-tools, testing
- platform: go, cli
- tags: pretty-printer, snapshot-testing, debugging, go-literals

## Member repositories
- sanity-io/litter (main) score 68

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:18.005325+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:44:50.518625+00:00, confidence not recorded.
  - readme: https://github.com/sanity-io/litter (fetched 2026-08-28T04:05:18.005325+00:00, sha 0f4a1100aebe)
- Data as of 2026-08-30T08:39:29.467469+00:00.
