A TOML parser for Go with reflection, compatible with TOML v1.1.0 and offering a CLI validator tool.
BurntSushi/toml is a Go library for parsing and generating TOML configuration files. It provides a reflection-based interface similar to Go's standard json and xml packages, enabling seamless integration with Go structs for configuration management. The library fully supports TOML v1.1.0 and includes a CLI validator tool for checking file correctness.
Go developers who need to read or write TOML configuration files in their applications, particularly those seeking an idiomatic, standard-library-like approach. It's also useful for DevOps engineers or tool authors who require a reliable TOML parser and validator within Go-based tools.
Developers choose this library because it offers a minimal, obvious API that integrates naturally with Go's ecosystem, mirroring the familiar patterns of encoding/json. Its full TOML v1.1.0 compliance and included CLI validator provide reliability and convenience not always found in alternatives.
TOML parser for Golang with reflection.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses a reflection interface identical to Go's json and xml packages, making it instantly familiar to developers and reducing the learning curve.
Supports the latest TOML specification, ensuring reliable parsing and generation without compatibility issues for modern features.
Includes the tomlv tool for command-line validation of TOML files, adding convenience for testing and debugging configurations.
Allows integration with encoding.TextUnmarshaler and custom UnmarshalTOML interfaces, enabling handling of complex types like email addresses as demonstrated in the README.
The reflection-based decoding, while convenient, can be slower than optimized, direct parsers, making it less suitable for latency-sensitive applications.
Only exported struct fields are processed, as noted in the README, which can complicate scenarios involving private or internal data structures.
Requires Go 1.18 or newer, potentially excluding legacy projects or environments with strict version constraints.