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,987 stars
MIT License

Repository Health

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

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
61 /100 Good
Architecture 68
Code Quality 62
Innovation 40
Learning Curve 75

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

Go
58%
Apache 2.0

agent-orchestrator

AI Agents · AI Code Assistants · Developer Tools

13,014

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
68
Dependency
Built with
Go 58%
TypeScript 39%
Updated today
Go
33%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,859

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
84
Repo Health
88
Technical
63
Dependency
Built with
Go 33%
Rust 26%
C 22%
Updated today
Go
33%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,859

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
84
Repo Health
88
Technical
63
Dependency
Built with
Go 33%
Rust 26%
C 22%
Updated today
Go
97%
Apache 2.0

Docker (Moby)

Developer Tools · Devops

72,164

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
Go 97%
Updated yesterday
Go
84%
Apache 2.0

frp

Networking

109,800

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
70
Dependency
Built with
Go 84%
Vue 11%
Updated today
Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,509

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
90
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated yesterday
Go
56%
Other

Multica

AI Assistants · AI Development

52,342

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

View details
87
Repo Health
83
Technical
67
Dependency
Built with
Go 56%
TypeScript 38%
Updated today
Go
82%
GPL 3.0

Navidrome

File Storage · Music Audio

24,068

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
Go 82%
JavaScript 15%
Updated yesterday
Go
98%
Apache 2.0

Nightingale

Monitoring

13,327

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
Go 98%
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