go-pretty
A Go library for rendering pretty console tables, lists, progress bars, and styled text with deep customization.
Repository Health
Technical Analysis
go-pretty is a Go module made up of independent, importable packages — table, list, progress, and text — for turning plain data into readable console output. The table package is the flagship: it renders headers, rows, and footers into ASCII, Unicode-box, HTML, Markdown, CSV, or TSV, with support for sorting, filtering, auto-merging cells, pagination, and per-column width and alignment control.
The list package prints hierarchical, indented lists with box-drawing characters, the progress package tracks one or more concurrent tasks with ETA and speed calculation, and the text package underpins all of them with ANSI-aware string manipulation for color, alignment, wrapping, and cursor control. Every package ships its own README, godoc comments, and worked examples, and each is usable standalone without pulling in the others.
What You Get
- A table writer with AppendRow/AppendHeader/AppendFooter, sorting, filtering, auto-merge, and pagination
- Multiple render formats from the same table: ASCII/Unicode, HTML, Markdown, CSV, and TSV
- A list renderer for hierarchical, indented, box-drawn lists with multiple output formats
- A progress tracker for one or more concurrent tasks with ETA, speed, and customizable indicator styles
- A text utility package with full ANSI escape sequence support for color, alignment, wrapping, and cursor control
- Runnable demo binaries under cmd/ (demo-table, demo-list, demo-progress) showing real usage
Common Use Cases
- Printing structured CLI output — reports, diagnostics, or query results — as aligned console tables
- Rendering the same tabular data as Markdown or CSV for docs and export alongside the terminal view
- Showing live progress for long-running CLI operations like downloads, migrations, or batch jobs
- Displaying hierarchical data — file trees, nested config, dependency graphs — as an indented console list
- Building colored, styled terminal output without hand-rolling ANSI escape sequences
Under The Hood
Architecture The module is organized as sibling packages under one Go module (table, list, progress, text) rather than a single monolithic writer, and each depends only on text for shared ANSI/alignment primitives. The table package centers on a Table struct whose Render() method walks a fixed pipeline — initForRender, renderTitle, renderRowsBorderTop, renderRowsHeader, renderRows, renderRowsFooter, renderRowsBorderBottom — with per-format variants (render_html.go, render_markdown.go, render_csv.go, render_tsv.go) reusing the same row/column model so one Table produces multiple output formats from unchanged data. Row and column configuration (config.go, row.go) is separated from rendering (render.go), and filtering/sorting (filter.go, sort.go) run as a pre-render pass over t.rows, keeping data transformation independent of output format.
Tech Stack
Written in Go 1.18+ with a small, deliberate dependency set: github.com/mattn/go-runewidth for terminal-width-aware string measurement, golang.org/x/term and golang.org/x/sys for terminal size and control, golang.org/x/text for Unicode-aware text handling, and github.com/stretchr/testify plus github.com/pkg/profile for tests and profiling — the runtime surface itself has no third-party dependencies. There is no build system beyond go build/go get; a Makefile wraps linting and coverage, and CI (.github/workflows/ci.yml) runs the test suite and SonarCloud/Coveralls checks on every push.
Code Quality The repo carries 46 _test.go files (roughly one per source file) using testify for assertions, alongside benchmark files (bench_test.go) in each package. Public types and exported functions have consistent godoc-style comments explaining behavior and caveats (e.g. AutoMerge’s documented limitations across render modes), and errors are returned as values rather than panics in the API surface. CI runs on every push/PR with coverage tracked via Coveralls and static analysis via SonarCloud, indicating an established quality bar.
What Makes It Unique Rather than committing to one output format, go-pretty models a table as format-agnostic row/column data and lets the caller pick ASCII, Unicode box-drawing, HTML, Markdown, CSV, or TSV from the same Table instance — most comparable Go table libraries commit to a single rendering style. Combining that with auto-merge, per-column width enforcement functions, and a pager interface in one cohesive package (rather than requiring separate libraries) is the project’s main differentiator, even though none of the individual techniques is novel on its own.
Used by 5 apps in this directory
Anarlog
Note Taking · AI Assistants · Productivity
Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.
Coder
Devops · Developer Tools · Code Editors
Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.
infracost
Devops · Developer Tools
Infracost shows cloud cost estimates for Terraform, CloudFormation, and AWS CDK before you deploy — in your terminal, editor, AI coding agent, and pull requests.
tau
Devops
Open-source, Git-native platform-as-a-service for building, deploying, and scaling fullstack apps on your own infrastructure with no DevOps required.
TiDB
Databases · AI Development
AI-Native Distributed SQL Database for Agentic Workloads