Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. go-toml

go-toml

NOASSERTIONGov2.4.3

A Go library for encoding and decoding TOML configuration files with high performance and stdlib-like behavior.

Visit WebsiteGitHubGitHub
2.0k stars248 forks0 contributors

What is go-toml?

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.

Target Audience

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.

Value Proposition

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.

Overview

Go library for the TOML file format

Use Cases

Best For

  • Parsing configuration files in Go applications
  • Generating TOML documents from Go structs
  • Building CLI tools that work with TOML files
  • Validating TOML configuration with strict error checking
  • Converting between TOML and JSON formats
  • Linting and formatting TOML files

Not Ideal For

  • Applications requiring advanced document manipulation or AST-level editing of TOML files
  • Teams upgrading from go-toml v1 who cannot easily refactor for breaking API changes
  • Projects where configuration is primarily in JSON or YAML, and TOML support is optional
  • Use cases needing built-in default value handling via struct tags or custom unmarshaler interfaces

Pros & Cons

Pros

High Performance

Benchmarks show 2-5x faster unmarshaling compared to go-toml v1 and BurntSushi/toml, making it efficient for processing large configuration files.

Stdlib-like Familiarity

Designed to mimic Go's encoding/json API, reducing the learning curve for developers already accustomed to standard library patterns.

Contextual Error Debugging

Provides DecodeError with human-readable messages that include line and column context, simplifying troubleshooting of TOML syntax issues.

Strict Mode Validation

Decoder can be set to error on unknown fields, helping catch typos and ensure configuration files are correct.

Local Date/Time Support

Offers native LocalDate, LocalTime, and LocalDateTime types to accurately represent TOML's local date/time without timezone confusion.

Cons

Breaking Changes from v1

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.

No Document Model

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.

Unstable Parser API

The Parser API for iterative AST parsing is explicitly marked as unstable, with no backward compatibility guarantees, risking future changes in production code.

External Dependency for Querying

Query features are absent; users must rely on third-party tools like dasel for JSONPath-style queries, adding complexity to the toolchain.

Frequently Asked Questions

Quick Stats

Stars1,962
Forks248
Contributors0
Open Issues8
Last commit5 days ago
CreatedSince 2013

Tags

#parsing#hacktoberfest#unmarshaling#file-format#configuration#golang#serialization#go#toml-parsing#cli-tools#toml#marshaling

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 5 hours ago

Related Projects

blackfridayblackfriday

Blackfriday: a markdown processor for Go

Stars5,610
Forks599
Last commit2 years ago
tomltoml

TOML parser for Golang with reflection.

Stars4,985
Forks559
Last commit26 days ago
goldmarkgoldmark

:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.

Stars4,908
Forks299
Last commit12 days ago
html-to-markdownhtml-to-markdown

⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

Stars3,755
Forks216
Last commit11 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub