Go Toml Versions Save

Go library for the TOML file format

v2.2.2

2 weeks ago

What's Changed

Fixed bugs

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.2.1...v2.2.2

v2.2.1

1 month ago

What's Changed

Fixed bugs

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.2.0...v2.2.1

v2.2.0

1 month ago

What's Changed

What's new

Fixed bugs

Documentation

Other changes

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.1.1...v2.2.0

v2.1.1

5 months ago

What's Changed

Fixed bugs

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.1.0...v2.1.1

v2.1.0

8 months ago

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: https://github.com/pelletier/go-toml/compare/v2.0.9...v2.1.0

v2.0.9

10 months ago

What's Changed

Fixed bugs

Other changes

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.8...v2.0.9

v2.0.8

11 months ago

What's Changed

What's new

Fixed bugs

Documentation

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.7...v2.0.8

v2.0.7

1 year ago

What's Changed

Fixed bugs

Documentation

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.6...v2.0.7

v2.0.6

1 year ago

What's Changed

What's new

Performance

Other changes

New Contributors

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.5...v2.0.6

v2.0.5

1 year ago

What's Changed

Fixed bugs

Full Changelog: https://github.com/pelletier/go-toml/compare/v2.0.4...v2.0.5