The viper package
viper is a powerful Go package that supports a plethora of options. All viper projects follow a pattern. First, you initialize viper and then you define the elements that interest you. After that, you get these elements and read their values in order to use them. Notice that the viper package can entirely replace the flag package.
The desired values can be either taken directly, as happens when you are using the flag package of the standard Go library, or indirectly using configuration files. When using formatted configuration files in the JSON, YAML, TOML, HCL, or Java properties format, viper does all the parsing for you, which saves you from having to write and debug lots of Go code. viper also allows you to extract and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access