finds.dev← search

// the find

BurntSushi/toml

★ 5,013 · Go · MIT · updated Aug 2026

TOML parser for Golang with reflection.

A TOML decoder/encoder for Go built on reflection, mirroring the ergonomics of encoding/json. It's aimed at anyone who needs to read or write TOML config files in a Go project without hand-rolling a parser, and it's been the de facto standard in the Go ecosystem for years (Hugo, Prometheus-adjacent tooling, etc. depend on it).

Full TOML v1.1.0 compliance validated against the toml-test suite, which is bundled in-tree rather than just referenced — you can see exactly which edge cases (bad UTF-8, datetime overflow, duplicate keys) it rejects. Struct tag support and UnmarshalTOML/encoding.TextUnmarshaler interop mean you're not stuck with field-name-matches-key limitations. Ships a standalone tomlv CLI validator as a separate buildable command, useful outside of any Go program. API shape is deliberately a clone of encoding/json's Decode/Encode, so there's near-zero learning curve if you've used that package.

Reflection-based decoding means no compile-time safety on struct/TOML key mismatches and a real performance cost versus codegen-based alternatives (go-toml/v2 benchmarks faster for large files). Only exported struct fields are considered, and this is 'silently' honored per the README — a private field that should hold a value just quietly doesn't, which is an easy footgun. No streaming decoder; the whole document is parsed into memory, so it's not the right choice for huge config files. Error messages are serviceable but not line/column-precise in all failure paths compared to some newer TOML libraries.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →