go-toml

The original Go library for loading, querying, and marshaling TOML documents, now superseded by go-toml v2.

Library
Go
vv1.9.5
1,982stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
79/100Good
Development Activity68
Maintenance72
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
61/100Good
Architecture68
Code Quality62
Innovation40
Learning Curve75

go-toml (v1) is a Go library for working with TOML configuration files. It parses TOML text into a Tree structure that can be navigated with dot-separated key paths, converted to and from Go structs via Marshal/Unmarshal, or queried with a JSONPath-like expression language in its query subpackage.

The module ships three companion CLI tools — tomll (a TOML linter/formatter), tomljson (TOML to JSON), and jsontoml (JSON to TOML) — distributed both as Go binaries and as a Docker image, useful for scripting and CI pipelines that touch TOML files without writing Go code.

This is the legacy v1 line of the project. Development has moved to go-toml v2 (a separate module path, github.com/pelletier/go-toml/v2), which is faster, spec-compliant, and actively maintained; v1 remains widely imported by existing codebases but receives no further feature work.

What You Get

  • Tree API for loading TOML from bytes, strings, readers, or files and navigating it with dot-separated key paths
  • Struct marshaling and unmarshaling via toml tags, including comment, multiline, literal, and commented-field options
  • A JSONPath-like query language (in the query subpackage) for pulling specific values out of a document without walking the tree manually
  • Line/column position tracking on every parsed node, surfaced in syntax error messages
  • Three standalone CLI tools — tomll, tomljson, jsontoml — plus a published Docker image for TOML linting and JSON conversion in scripts or CI

Common Use Cases

  • Reading application configuration files into typed Go structs at startup
  • Converting between TOML and JSON in build scripts or CI pipelines using the tomljson/jsontoml CLI tools
  • Programmatically inspecting or rewriting TOML documents (e.g. config migration tools) via the Tree API
  • Linting and auto-formatting TOML files with tomll as a pre-commit or CI check

Under The Hood

Architecture A hand-written lexer/parser pair (lexer.go, parser.go, token.go) feeds toml.go’s Load*/LoadBytes entrypoints, producing a *Tree backed by a map[string]interface{} whose values are wrapped tomlValue nodes, nested *Tree nodes, or []*Tree slices; marshal.go and tomltree_create.go/tomltree_write.go add reflection-based struct marshaling and tree serialization on top of that same model. The query subpackage layers its own independent lexer/parser/matcher (query/lexer.go, query/parser.go, query/match.go) over the identical Tree, so document traversal happens through two separate code paths — direct GetPath calls or compiled query expressions — that both ultimately walk the same values map, meaning any change to the Tree’s internal representation ripples through Marshal, Unmarshal, and Query alike.

Tech Stack go.mod pins module github.com/pelletier/go-toml at go 1.12 with an empty go.sum — there are no third-party runtime dependencies, and TOML parsing is entirely hand-rolled rather than delegated to a parser-generator or external grammar library. The one borrowed piece is localtime.go, vendored from Google’s civil library (Apache 2.0) for local date/time types. The cmd/ directory holds four thin CLI wrappers (tomll, tomljson, jsontoml, tomltestgen) built only on the standard library plus the root package. CI runs on Azure Pipelines with gofmt, coverage, and multi-version Go test jobs, and a Dockerfile publishes the CLI tools to Docker Hub.

Code Quality Thirteen _test.go files at the repo root (parser_test.go, marshal_test.go, lexer_test.go, keysparsing_test.go, position_test.go, token_test.go, tomltree_create_test.go, tomltree_write_test.go, localtime_test.go, toml_test.go, toml_testgen_test.go, and more) plus a dedicated test suite inside query/ give broad coverage across lexing, parsing, marshaling, and querying, including a run of the shared upstream TOML compliance suite via toml_testgen_test.go. Error handling relies on plain error returns (errors.New/fmt.Errorf) rather than a typed error hierarchy, and LoadBytes recovers from internal parser panics and converts them into normal returned errors. Type safety is limited by design — Tree.Get and query results return interface{}, pushing type assertions onto callers. CI enforces gofmt but there’s no additional linter configuration.

API Design The Tree API’s dot-path Get/GetPath/Set/Delete methods and the JSONPath-like query subpackage are the two ergonomic standouts, giving callers either generic document traversal or single-expression value extraction — a broader surface than most Go TOML libraries, which typically offer only Unmarshal-into-struct. Struct-tag support (toml, comment, commented, multiline, literal, default) is comprehensive for a v1-era library. The tradeoff is inherited complexity for consumers: interface{}-typed results force manual type assertions, and the project’s own documentation now actively redirects every new user to go-toml v2’s stricter, faster API — so v1’s design reads as a snapshot of pre-v2 idioms rather than a current reference point.

Used by 13 apps in this directory

Apache 2.0

agent-orchestrator

AI Agents · AI Code Assistants · Developer Tools

12,144

A local desktop workspace that gives every coding task its own agent, Git branch, and worktree, then tracks tasks, pull requests, CI, and reviews for 27 coding agents on one live Kanban board.

View details
86
Repo Health
83
Technical
0
Dependency
Go
33%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

12,344

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
83
Repo Health
88
Technical
63
Dependency
Built with
Go33%
Rust26%
C23%
Updated 3 days ago
Go
33%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

12,344

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
83
Repo Health
88
Technical
63
Dependency
Built with
Go33%
Rust26%
C23%
Updated 3 days ago
Go
97%
Apache 2.0

Docker (Moby)

Devops · Developer Tools

72,104

The open-source container engine at the heart of Docker — a modular toolkit of runtime, build, and networking components for assembling container-based systems.

View details
98
Repo Health
86
Technical
69
Dependency
Built with
Go97%
Updated 3 days ago
Go
83%
Apache 2.0

frp

Networking

109,434

A fast reverse proxy that exposes local servers behind NAT or firewalls to the public internet with multi-protocol support.

View details
95
Repo Health
82
Technical
71
Dependency
Built with
Go83%
Vue12%
Updated 3 days ago
Go
62%
Apache 2.0

Harness Open Source

Developer Tools · Devops · Code Editors

38,349

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
64
Dependency
Built with
Go62%
TypeScript34%
Updated 1 weeks ago
Go
57%
Other

Multica

AI Assistants · AI Development

49,852

Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.

View details
86
Repo Health
83
Technical
67
Dependency
Built with
Go57%
TypeScript38%
Updated 3 days ago
Go
81%
GPL 3.0

Navidrome

File Storage

23,561

Run your own personal Spotify — stream your entire music collection from any device, anywhere, forever.

View details
91
Repo Health
81
Technical
69
Dependency
Built with
Go81%
JavaScript15%
Updated 2 days ago
Go
98%
Apache 2.0

Nightingale

Monitoring

13,287

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
67
Dependency
Built with
Go98%
Updated 2 days ago

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