3.5 KiB
3.5 KiB
Changelog
All notable changes to interpres are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[development]
Added
[1.0.0] - 2026-08-20
First stable release: a dependency-free TOML 1.0 parser and encoder for Go that uses only the standard library and passes the entire toml-test suite (185 valid and 371 invalid cases, 0 failures).
Added
Parsing
Parse(data []byte) (map[string]any, error): decode a TOML document into an untyped tree.- Full TOML 1.0 syntax: comments; bare, quoted, and dotted keys; tables
(
[a.b]) and arrays of tables ([[a]]); basic and literal strings, including multiline ("""/''') with escape sequences and line-ending backslash trimming; integers in decimal, hex (0x), octal (0o), and binary (0b) with_separators; floats with exponents andinf/nan; booleans; offset/local date-times, dates, and times; arrays; and inline tables. - Distinct date-time types: offset date-times decode to
time.Time, whileLocalDateTime,LocalDate, andLocalTimerepresent the local variants, each with aString()method returning the TOML-canonical rendering. - Strict, spec-conformant validation that rejects invalid documents: leading zeros, misplaced underscores, malformed floats and radix literals, control characters in strings and comments, bare carriage returns, non-UTF-8 input, out-of-range Unicode escapes, multiline strings used as keys, single-digit date-time components, duplicate/overwriting inline-table keys, and the full family of table redefinitions (header vs. header, header vs. dotted key, array of tables vs. table, and dotted-key appends to defined tables).
SyntaxErrorcarrying the 1-based line of a malformed document.
Decoding
Unmarshal(data []byte, v any): parse and map onto a struct ormap[string]anyvia reflection, with overflow-checked numeric conversion, nested structs, slices, andmap[string]T.toml:"name"field tags, case-insensitive name fallback, andtoml:"-"to skip a field.DecoderwithDisallowUnknownFieldsfor strict decoding that rejects keys without a destination field, at every struct depth.Unmarshalerinterface (UnmarshalTOML(data any) error) for types that take full control of their decode.
Encoding
Marshal(v any) ([]byte, error): encode a struct ormap[string]Vvalue to a TOML 1.0 document that re-parses to an equivalent value tree.Encoderwith chainable policy options:GroupByKind(group-by-kind layout versus declaration order),OmitEmptyArrays, andUseLiteralMultiline.Marshalerinterface (MarshalTOML() (any, error)) for types that need a custom TOML shape; the returned value is encoded normally.
Cancellation
ParseContext,UnmarshalContext,MarshalContext,(*Decoder).DecodeContextand(*Encoder).MarshalContexthonour acontext.Context, checked up front and every 64 statements or fields.
Project
- Standard library only: zero third-party modules.
cmd/interpres-decode, a toml-test harness adapter (TOML on stdin, tagged JSON on stdout).- A runnable example, a table-driven Go test suite, and a canonical
justrecipe set whosegatesrecipe is the definition of done. - Hand-written CI pipelines for the test, race and release gates.
SECURITY.mdfor private vulnerability reports.