This is the first release built largely with the help of AI coding agents. Highlights include the complete removal of the unsafe package. go-toml is now fully safe Go code, with a geomean overhead of only ~1.4% vs v2.2.4 and zero additional allocations on benchmarks. This release also adds omitzero struct tag support, improves UnmarshalText/Unmarshaler handling for tables and array tables, and fixes several bugs including nil pointer marshaling, leap second handling, and datetime unmarshaling panics.
What's Changed
What's new
- marshal: don't escape quotes unnecessarily by @virtuald in https://github.com/pelletier/go-toml/pull/991
- Add
omitzerotag support by @NathanBaulch in https://github.com/pelletier/go-toml/pull/998 - Support custom IsZero() methods with omitzero tag by @pelletier in https://github.com/pelletier/go-toml/pull/1020
- UnmarshalText fallbacks to struct unmarshaling for tables and arrays by @pelletier in https://github.com/pelletier/go-toml/pull/1026
- [unstable] Support Unmarshaler interface for tables and array tables by @pelletier in https://github.com/pelletier/go-toml/pull/1027
Fixed bugs
- Add missing UnmarshalTOML call by @pelletier in https://github.com/pelletier/go-toml/pull/996
- Handle array table into an empty slice by @pelletier in https://github.com/pelletier/go-toml/pull/997
- Unwrap strict errors by @bersace in https://github.com/pelletier/go-toml/pull/1012
- Fix leap second handling found by fuzz by @pelletier in https://github.com/pelletier/go-toml/pull/1019
- Fix nil pointer map values not being marshaled by @pelletier in https://github.com/pelletier/go-toml/pull/1025
- Fix panic when unmarshaling datetime values to incompatible types (#1028) by @pelletier in https://github.com/pelletier/go-toml/pull/1029
- Fix parser error pointing to wrong line at EOF without trailing newline by @pelletier in https://github.com/pelletier/go-toml/pull/1041
Documentation
- Improve Unmarshaling README by @heckelson in https://github.com/pelletier/go-toml/pull/1016
- Create AGENTS.md guidelines file by @pelletier in https://github.com/pelletier/go-toml/pull/1017
Other changes
- Unsafe package removal by @pelletier in https://github.com/pelletier/go-toml/pull/1021
- Bump CI and test scripts to Go 1.26 by @pelletier in https://github.com/pelletier/go-toml/pull/1030
New Contributors
- @virtuald made their first contribution in https://github.com/pelletier/go-toml/pull/991
- @NathanBaulch made their first contribution in https://github.com/pelletier/go-toml/pull/999
- @bersace made their first contribution in https://github.com/pelletier/go-toml/pull/1012
- @flyn-org made their first contribution in https://github.com/pelletier/go-toml/pull/1013
- @heckelson made their first contribution in https://github.com/pelletier/go-toml/pull/1016
Full Changelog: https://github.com/pelletier/go-toml/compare/v2.2.4...v2.3.0