go-pretty

A Go library for rendering pretty console tables, lists, progress bars, and styled text with deep customization.

Library
Go
vv6.8.3
3,555 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
67 /100 Good
Development Activity 56
Maintenance 60
Community 52
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 80
Code Quality 85
Innovation 60
Learning Curve 85

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

Rust
45%
MIT

Anarlog

AI Assistants · Note Taking · Productivity

9,468

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.

View details
86
Repo Health
77
Technical
68
Dependency
Built with
Rust 45%
TypeScript 40%
Updated today
Go
75%
AGPL 3.0

Coder

Code Editors · Developer Tools · Devops

16,920

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

View details
91
Repo Health
90
Technical
66
Dependency
Built with
Go 75%
TypeScript 23%
Updated today
Go
97%
Apache 2.0

infracost

Developer Tools · Devops

12,560

Infracost shows cloud cost estimates for Terraform, CloudFormation, and AWS CDK before you deploy — in your terminal, editor, AI coding agent, and pull requests.

View details
82
Repo Health
78
Technical
67
Dependency
Built with
Go 97%
Updated yesterday
Go
90%
BSD 3

tau

Devops

5,176

Open-source, Git-native platform-as-a-service for building, deploying, and scaling fullstack apps on your own infrastructure with no DevOps required.

View details
79
Repo Health
82
Technical
64
Dependency
Built with
Go 90%
Updated 1 months ago
Go
95%
Apache 2.0

TiDB

AI Development · Databases

40,630

AI-Native Distributed SQL Database for Agentic Workloads

View details
97
Repo Health
66
Technical
67
Dependency
Built with
Go 95%
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