Skip to content

Releases: pelletier/go-toml

v2.3.0

24 Mar 14:16
f36a3ec

Choose a tag to compare

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

Fixed bugs

Documentation

Other changes

New Contributors

Full Changelog: v2.2.4...v2.3.0

v2.2.4

07 Apr 14:20
ee07c92

Choose a tag to compare

Highlight

In this release, @mikattack removed the last dependency of go-toml! 🎉 (#981)

What's Changed

Documentation

Other changes

New Contributors

Full Changelog: v2.2.3...v2.2.4

v2.2.3

23 Aug 17:49
b730b2b

Choose a tag to compare

What's Changed

What's new

Performance

  • Remove unstable.Parser allocation when creating Decoder by @mvdan in #953

Fixed bugs

Documentation

Other changes

New Contributors

Full Changelog: v2.2.2...v2.2.3

v2.2.2

01 May 15:13
a3d5a0b

Choose a tag to compare

What's Changed

Fixed bugs

  • Fix race condition when tracking keys that have already been seen by @sysulq in #947

New Contributors

Full Changelog: v2.2.1...v2.2.2

v2.2.1

12 Apr 14:49
d00d2cc

Choose a tag to compare

What's Changed

Fixed bugs

  • Encode: fix indentation when marshalling slices as array tables by @daniel-weisse in #944

New Contributors

Full Changelog: v2.2.0...v2.2.1

v2.2.0

19 Mar 18:45
86608d7

Choose a tag to compare

What's Changed

What's new

  • Encode: support pointers to embedded structs by @dangra in #924
  • Encode: support json.Number type by @dangra in #923
  • Decode: unstable/Unmarshal interface by @rszyma in #940

Fixed bugs

Documentation

Other changes

New Contributors

Full Changelog: v2.1.1...v2.2.0

v2.1.1

11 Dec 19:26
34765b4

Choose a tag to compare

What's Changed

Fixed bugs

  • Fix unmarshaling of nested non-exported struct by @pelletier in #917

New Contributors

Full Changelog: v2.1.0...v2.1.1

v2.1.0

29 Aug 13:27
3175efb

Choose a tag to compare

This new minor release brings back the commented struct field tag from go-toml v1. It makes it easier to generate default or example configuration files. For instance:

type TLS struct {
	Cipher  string `toml:"cipher"`
	Version string `toml:"version"`
}
type Config struct {
	Host string `toml:"host" comment:"Host IP to connect to."`
	Port int    `toml:"port" comment:"Port of the remote server."`
	Tls  TLS    `toml:"TLS,commented" comment:"Encryption parameters (optional)"`
}
example := Config{
	Host: "127.0.0.1",
	Port: 4242,
	Tls: TLS{
		Cipher:  "AEAD-AES128-GCM-SHA256",
		Version: "TLS 1.3",
	},
}
out, err := toml.Marshal(example)

generates this TOML document:

# Host IP to connect to.
host = '127.0.0.1'
# Port of the remote server.
port = 4242

# Encryption parameters (optional)
# [TLS]
# cipher = 'AEAD-AES128-GCM-SHA256'
# version = 'TLS 1.3'

This feature was often mentioned as a blocker to upgrading from go-toml v1. Hopefully bringing it back in scope will help folks make the transition!

An other noteworthy improvement is on type mismatch errors. They now include the human-readable context, and include the struct field name of the faulty value if applicable.

Before:

toml: cannot store TOML string into a Go int

After:

1| [server]
2| path = "/my/path"
3| port = "bad"
 |        ~~~~~ cannot decode TOML string into struct field toml_test.Server.Port of type int

What's Changed

What's new

Fixed bugs

Other changes

New Contributors

Full Changelog: v2.0.9...v2.1.0

v2.0.9

13 Jul 14:03
e183db7

Choose a tag to compare

What's Changed

Fixed bugs

Other changes

  • build(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4 by @dependabot in #877

New Contributors

Full Changelog: v2.0.8...v2.0.9

v2.0.8

23 May 22:41
7b980e7

Choose a tag to compare

What's Changed

What's new

Fixed bugs

Documentation

New Contributors

Full Changelog: v2.0.7...v2.0.8