A Go library for encoding and decoding TOML configuration files with high performance and stdlib-like behavior.
go-toml is a Go library for working with the TOML file format, enabling encoding and decoding of TOML documents to and from Go data structures. It solves the problem of parsing and generating TOML configuration files in Go applications with high performance and a familiar API. The library supports the full TOML v1.0.0 specification and includes features like strict mode validation and local date/time types.
Go developers who need to read or write TOML configuration files in their applications, particularly those working on tools, services, or CLI applications that use TOML for settings.
Developers choose go-toml for its excellent performance compared to other Go TOML libraries, its stdlib-like API that reduces learning curve, and its comprehensive feature set including strict validation mode and contextual error messages. It's maintained, supports the latest TOML spec, and comes with useful command-line tools.
Go library for the TOML file format
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show 2-5x faster unmarshaling compared to go-toml v1 and BurntSushi/toml, making it efficient for processing large configuration files.
Designed to mimic Go's encoding/json API, reducing the learning curve for developers already accustomed to standard library patterns.
Provides DecodeError with human-readable messages that include line and column context, simplifying troubleshooting of TOML syntax issues.
Decoder can be set to error on unknown fields, helping catch typos and ensure configuration files are correct.
Offers native LocalDate, LocalTime, and LocalDateTime types to accurately represent TOML's local date/time without timezone confusion.
Migration to v2 requires significant code changes due to dropped features like default struct tags, Unmarshaler interface, and altered behavior in decoding arrays and interfaces.
Removed support for tom.Tree and query functionality, forcing users to handle arbitrary structures with maps and reflection, which is less convenient for complex manipulations.
The Parser API for iterative AST parsing is explicitly marked as unstable, with no backward compatibility guarantees, risking future changes in production code.
Query features are absent; users must rely on third-party tools like dasel for JSONPath-style queries, adding complexity to the toolchain.