Releases: pelletier/go-toml
v2.2.3
What's Changed
What's new
- Allow
int
,uint
, andfloat
as map keys by @daniel-weisse in #958
Performance
Fixed bugs
- Fix reflect.Pointer backward compatibility by @xxxVitoxxx in #956
Documentation
Other changes
- go.mod: bump minimum language version to 1.21 by @mvdan in #949
- Bump testing to go 1.23 by @pelletier in #961
New Contributors
- @mvdan made their first contribution in #949
- @testwill made their first contribution in #951
- @xxxVitoxxx made their first contribution in #956
Full Changelog: v2.2.2...v2.2.3
v2.2.2
v2.2.1
What's Changed
Fixed bugs
- Encode: fix indentation when marshalling slices as array tables by @daniel-weisse in #944
New Contributors
- @daniel-weisse made their first contribution in #944
Full Changelog: v2.2.0...v2.2.1
v2.2.0
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
- Decode: fix reuse of slice for array tables by @pelletier in #934
Documentation
- Fix typo in README by @jwilk in #925
- Fix indentation of README examples by @rdbo in #928
- Fix marshaler typos by @pelletier in #927
Other changes
- Go 1.22 support by @pelletier in #935
New Contributors
- @dangra made their first contribution in #924
- @jwilk made their first contribution in #925
- @rdbo made their first contribution in #928
- @rszyma made their first contribution in #940
Full Changelog: v2.1.1...v2.2.0
v2.1.1
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
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
- Encoder: add back the commented option by @pelletier in #893
Fixed bugs
- Decode: fix panic when parsing '0' as a float by @ocean2811 in #887
- Encode: fix ignored indent of array tables by @pelletier in #889
- Unstable/parser: add raw to integers by @pelletier in #890
- Decode: improve errors on integers and strings by @pelletier in #891
- Decode: fix wrong indention for comments on tables by @Felixoid in #892
Other changes
- Add support for
Go 1.21
by @michalbiesek in #885
New Contributors
- @michalbiesek made their first contribution in #885
- @ocean2811 made their first contribution in #887
Full Changelog: v2.0.9...v2.1.0
v2.0.9
What's Changed
Fixed bugs
- Encode: fix support for arrays by @MrJetBOX in #876
- Decode: assign empty struct to empty defined sections by @dbarrosop in #879
Other changes
- build(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4 by @dependabot in #877
New Contributors
- @MrJetBOX made their first contribution in #876
- @dbarrosop made their first contribution in #879
Full Changelog: v2.0.8...v2.0.9
v2.0.8
What's Changed
What's new
- Support MarshalText/UnmarshalText for map keys by @gordon-klotho in #863
- Experimental: comments support in unstable/Parser by @pelletier in #860
Fixed bugs
- Decode: fix decode into unsettable structs by @pelletier in #868
Documentation
- Add example on how to use TextUnmarshaler by @pelletier in #867
New Contributors
- @manunio made their first contribution in #861
- @gordon-klotho made their first contribution in #863
Full Changelog: v2.0.7...v2.0.8
v2.0.7
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
- @DavidKorczynski made their first contribution in #831
- @cuonglm made their first contribution in #837
- @PotatoesFall made their first contribution in #841
- @deining made their first contribution in #849
Full Changelog: v2.0.6...v2.0.7
v2.0.6
What's Changed
What's new
- Expose parser API as unstable by @pelletier in #827
Performance
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