• v1.0.0 591d1f01d1

    v1.0.0 Stable

    petrbalvin released this 2026-06-20 10:24:03 +00:00 | 4 commits to main since this release

    First stable release: a dependency-free TOML 1.0 parser 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 and inf / nan; booleans;
      offset/local date-times, dates, and times; arrays; and inline tables.
    • Distinct date-time types: offset date-times decode to time.Time, while
      LocalDateTime, LocalDate, and LocalTime represent the local variants.
    • 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).

    Decoding

    • Unmarshal(data []byte, v any) — parse and map onto a struct or
      map[string]any via reflection.
    • toml:"name" field tags, case-insensitive name fallback, and toml:"-" to
      skip a field.
    • Decoder with DisallowUnknownFields for strict decoding that rejects keys
      without a destination field.
    • SyntaxError carrying the 1-based line of a malformed document.

    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 Go test suite, and a just task set (install, run,
    Downloads