← All tools

LarsArtmann/go-output

Popularity 65 Updated Data & Databases

Write your data once. Render it anywhere. 16 output formats across tables, trees, and diagrams, plus NOM-style real-time progress visualization. Zero heavy deps in root.

githubauto-collected

Installation

A directly usable install command is not verified yet. Check the project documentation or releases.

go-output

Write your data once. Render it anywhere. One library. Sixteen formats. Three data shapes. Zero lock-in.

📚 Documentation · 🚀 Quick Start · 📋 Format Matrix

go-output is a Go library that turns your structured data into 16 output formats — tables, trees, and diagrams — with type-safe enums, branded IDs, and zero-config color support. It also includes NOM-style real-time progress visualization for long-running workflows, inspired by nix-output-monitor.

import "github.com/larsartmann/go-output"

The root module has zero heavy dependencies — only golang.org/x/term. YAML, lipgloss, bubbletea, and diagram renderers live in isolated sub-modules you import only when you need them.

Requires Go 1.26+.

---

Quick Start

Build tabular data once, render it in any format:

import (
    "os"

    "github.com/larsartmann/go-output"
    "github.com/larsartmann/go-output/delimited"
    "github.com/larsartmann/go-output/markdown"
    "github.com/larsartmann/go-output/serialization"
)

// Define your data once
data := output.NewTable([]string{"Name", "Health", "Complexity"})
data.AddRow([]string{"Alpha", "90%", "7/10"})

data.SetFooter([]string{"Total", "2", "-"})

// Render to Markdown md := markdown.NewMarkdownTable() md.SetHeaders(data.GetHeaders()) for , row := range data.GetRows() { md.AddRow(row) } out, := md.Render()

// Or serialize to JSON jtr := serialization.NewJSONTableRenderer() jtr.SetData(data) out, = jtr.Render()

// Or stream to CSV csv := delimited.NewCSVWriter(os.Stdout) = csv.WriteHeader(data.GetHeaders()) for , row := range data.GetRows() { = csv.WriteRow(row) } csv.Flush()


> **Sub-module imports** (e.g., `delimited`, `markdown`, `serialization`) require cloning the repo and setting up the workspace — see [Installation](#installation). Root-only usage works with just `go get`.

Use the `Format` enum for runtime format selection — perfect for CLI flags:

format, := output.ParseFormat("json") // validates input fmt.Println(format.Supports(output.ShapeTable)) // true fmt.Println(format.Shapes()) // [table tree graph]


Or dispatch through the unified renderer: