Skip to content

Releases: pelletier/go-toml

v2.2.3

23 Aug 17:49
b730b2b
Compare
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
Compare
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
Compare
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
Compare
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
Compare
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
Compare
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
Compare
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
Compare
Choose a tag to compare

What's Changed

What's new

Fixed bugs

Documentation

New Contributors

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

v2.0.7

28 Feb 16:48
643c251
Compare
Choose a tag to compare

What's Changed

Fixed bugs

  • Encode: fix inline table first key value whitespace by @cuonglm in #837
  • Decode: allow integers to be unmarshaled into floats by @PotatoesFall in #841
  • Decode: fix error reporting of type mismatch on inline tables by @pelletier in #853
  • Decode: fix panic when unmarshaling into a map twice by @pelletier in #854

Documentation

New Contributors

Full Changelog: v2.0.6...v2.0.7

v2.0.6

17 Nov 02:53
94bd3dd
Compare
Choose a tag to compare

What's Changed

What's new

Performance

  • Reduce init time allocation when declaring types used for reflect by @dolmen in #821

Other changes

  • refactor: Use typeMismatchError rather than raw string error by @jidicula in #826
  • build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in #825
  • build(deps): bump actions/setup-go from 2 to 3 by @dependabot in #820

New Contributors

Full Changelog: v2.0.5...v2.0.6