go-toml-edit v0.3.0 /Changelog
On this page

#Changelog

#0.3.0

Position spans on every AST node: Span() exposes 1-based start/end line and column from the most recent parse.

Context

Consumers doing their own semantic validation over the AST (unknown keys, wrong types, out-of-range values) previously had positions only on ParseError. Spans are populated from lexer tokens at parse time and are deliberately not recomputed by edits: nodes created programmatically carry the zero (invalid) span, and edited documents must be re-parsed for fresh positions.

#Features

  • Position spans. Every AST node (tables, array tables, key-values, keys, scalars, arrays, inline tables, comments) now exposes Span() with 1-based start/end line and column from the most recent parse, enabling consumers to attach precise source positions to their own semantic validation diagnostics.

#0.2.2

Bug fix: ParseError positions for EOF and duplicate-key errors.

#Fixes

  • Bug fix. ParseError now reports correct line/column positions for EOF errors and duplicate-key/table errors (previously reported line 0, column 0).

#0.2.1

Deterministic inline table key ordering

Context

mapToInlineTableNode now sorts keys alphabetically, fixing non-deterministic output for deeply nested maps in Marshal.

#Fixes

  • Bug fix. Inline tables in Marshal output now have deterministic key ordering.

#0.2.0

Add Marshal for map-to-TOML serialization

Context

strictcli needs Marshal to write TOML config files. This adds the inverse of Unmarshal for map types (struct support deferred to v2).

#Features

  • New feature. Marshal(v any) ([]byte, error) serializes Go maps to TOML bytes. Supports flat and nested map[string]any with all primitive types. Nested maps become [section] headers; keys are sorted for deterministic output.

#0.1.2

#Fixes

  • Fix. Preserve intra-array comments in Format() output.
  • Fix. Fix README Walk example to include required WalkMode parameter.

#0.1.1

#Breaking

  • Breaking. Walk now requires explicit WalkMode parameter (WalkLeaves or WalkAll).

#Fixes

  • Fix. Preserve comments between array elements when arrays are re-rendered.
  • Fix. Preserve original key formatting (quoted vs bare) for clean keys in dirty KVs; fix key node not marked dirty on Rename.

#0.1.0

  • No user-facing changes.

#0.0.1

#Features

  • Feature. Full TOML 1.0 parser with comment and whitespace preservation, zero-diff round-trip serialization, document editing API, typed getters, fluent cursor API, path resolution, formatter, and toml-test suite compliance.
  • Feature. Unmarshal and Decode with struct tags, embedded structs, custom Unmarshaler, TextUnmarshaler.
  • Feature. Items iterator (range-over-func) and Len for arrays.
  • Feature. SetComment and SetLeadingComments helpers.
  • Feature. Walk for depth-first document traversal.
  • Feature. MergeDefaults and Merge for deep merging.
  • Feature. Diff for comparing two documents.

#Fixes

  • Fix. Merge copies all [[array-table]] entries instead of only the first.
  • Fix. Walk emits correct paths for array-of-tables sub-tables.
  • Fix. SetComment on inline table members returns error.
Search