diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-12 15:26:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 15:26:20 +0100 |
commit | 2cdab5d53923784e72020d70ee9375518f19f9b6 (patch) | |
tree | 61f509a65109d2e7b0b69afd1cce56f3c8d55f28 /vendor/github.com/BurntSushi/toml/README.md | |
parent | c75c6ce908652afad82612f7d9096925140f19b1 (diff) | |
parent | 47374aac86ddc17c3cbd35dd52150191b3b6d44b (diff) | |
download | podman-2cdab5d53923784e72020d70ee9375518f19f9b6.tar.gz podman-2cdab5d53923784e72020d70ee9375518f19f9b6.tar.bz2 podman-2cdab5d53923784e72020d70ee9375518f19f9b6.zip |
Merge pull request #12824 from containers/dependabot/go_modules/github.com/BurntSushi/toml-1.0.0
Bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0
Diffstat (limited to 'vendor/github.com/BurntSushi/toml/README.md')
-rw-r--r-- | vendor/github.com/BurntSushi/toml/README.md | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/vendor/github.com/BurntSushi/toml/README.md b/vendor/github.com/BurntSushi/toml/README.md index 64410cf75..cc13f8667 100644 --- a/vendor/github.com/BurntSushi/toml/README.md +++ b/vendor/github.com/BurntSushi/toml/README.md @@ -1,10 +1,6 @@ -## TOML parser and encoder for Go with reflection - TOML stands for Tom's Obvious, Minimal Language. This Go package provides a reflection interface similar to Go's standard library `json` and `xml` -packages. This package also supports the `encoding.TextUnmarshaler` and -`encoding.TextMarshaler` interfaces so that you can define custom data -representations. (There is an example of this below.) +packages. Compatible with TOML version [v1.0.0](https://toml.io/en/v1.0.0). @@ -16,26 +12,25 @@ v0.4.0`). This library requires Go 1.13 or newer; install it with: - $ go get github.com/BurntSushi/toml + % go get github.com/BurntSushi/toml@latest It also comes with a TOML validator CLI tool: - $ go get github.com/BurntSushi/toml/cmd/tomlv - $ tomlv some-toml-file.toml + % go install github.com/BurntSushi/toml/cmd/tomlv@latest + % tomlv some-toml-file.toml ### Testing +This package passes all tests in [toml-test] for both the decoder and the +encoder. -This package passes all tests in -[toml-test](https://github.com/BurntSushi/toml-test) for both the decoder -and the encoder. +[toml-test]: https://github.com/BurntSushi/toml-test ### Examples +This package works similar to how the Go standard library handles XML and JSON. +Namely, data is loaded into Go values via reflection. -This package works similarly to how the Go standard library handles XML and -JSON. Namely, data is loaded into Go values via reflection. - -For the simplest example, consider some TOML file as just a list of keys -and values: +For the simplest example, consider some TOML file as just a list of keys and +values: ```toml Age = 25 @@ -61,9 +56,8 @@ And then decoded with: ```go var conf Config -if _, err := toml.Decode(tomlData, &conf); err != nil { - // handle error -} +err := toml.Decode(tomlData, &conf) +// handle error ``` You can also use struct tags if your struct field name doesn't map to a TOML @@ -75,15 +69,14 @@ some_key_NAME = "wat" ```go type TOML struct { - ObscureKey string `toml:"some_key_NAME"` + ObscureKey string `toml:"some_key_NAME"` } ``` Beware that like other most other decoders **only exported fields** are considered when encoding and decoding; private fields are silently ignored. -### Using the `encoding.TextUnmarshaler` interface - +### Using the `Marshaler` and `encoding.TextUnmarshaler` interfaces Here's an example that automatically parses duration strings into `time.Duration` values: @@ -136,7 +129,6 @@ To target TOML specifically you can implement `UnmarshalTOML` TOML interface in a similar way. ### More complex usage - Here's an example of how to load the example from the official spec page: ```toml @@ -216,5 +208,4 @@ type clients struct { Note that a case insensitive match will be tried if an exact match can't be found. -A working example of the above can be found in `_examples/example.{go,toml}`. - +A working example of the above can be found in `_example/example.{go,toml}`. |