Configuration using TOML, YAML, and JSON

There are many configuration formats that Go, with the use of third-party libraries, supports. Three of the most popular data formats are TOML, YAML, and JSON. Go can support JSON out of the box, and the others have clues on how to marshal/unmarshal or encode/decode data for these formats. These formats have many benefits beyond configuration, but this chapter will largely focus on converting a Go structure in the form of a configuration structure. This recipe will explore basic input and output using these formats.

These formats also provide an interface by which Go and applications written in other languages can share the same configuration. There are also a number of tools that deal with these formats and simplify working with them.

 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.37.169