Package Usage: go: github.com/hairyhenderson/toml
Package toml provides facilities for decoding and encoding TOML configuration
files via reflection. There is also support for delaying decoding with
the Primitive type, and querying the set of keys in a TOML document with the
MetaData type.
The specification implemented: https://github.com/toml-lang/toml
The sub-command github.com/BurntSushi/toml/cmd/tomlv can be used to verify
whether a file is a valid TOML document. It can also be used to print the
type of each key in a TOML document.
There are two important types of tests used for this package. The first is
contained inside '*_test.go' files and uses the standard Go unit testing
framework. These tests are primarily devoted to holistically testing the
decoder and encoder.
The second type of testing is used to verify the implementation's adherence
to the TOML specification. These tests have been factored into their own
project: https://github.com/BurntSushi/toml-test
The reason the tests are in a separate project is so that they can be used by
any implementation of TOML. Namely, it is language agnostic.
Example StrictDecoding shows how to detect whether there are keys in the
TOML document that weren't decoded into the value given. This is useful
for returning an error to the user if they've included extraneous fields
in their configuration.
Example UnmarshalTOML shows how to implement a struct type that knows how to
unmarshal itself. The struct must take full responsibility for mapping the
values passed into the struct. The method may be used with interfaces in a
struct in cases where the actual type is not known until the data is
examined.
Example Unmarshaler shows how to decode TOML strings into your own
custom data type.
6 versions
Latest release: almost 4 years ago
67 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/hairyhenderson/toml