go.deanishe.net/env (go): Package env maps environment variables to struct fields and vice versa.  It is heavily based on github.com/caarlos0/env, but has different semantics, and also allows the dumping of a struct to environment variables, not just populating a struct from environment variables.  Read environment variables with the Get* functions:  Populate a struct from the environment by passing it to Bind():  Use tags to specify a variable name or ignore a field:  Dump a struct to a map[string]string by passing it to Dump():  Add `env:"..."` tags to your struct fields to bind them to specific environment variables or ignore them. `env:"-"` tells Bind() to ignore the field:  Add `env:"VARNAME"` to bind a field to the variable VARNAME:  Variables are retrieved via implementors of the Env interface, which Bind() accepts as a second, optional parameter.  So you can pass a custom Env implementation to Bind() to populate structs from a source other than environment variables.  See _examples/docopt to see a custom Env implementation used to populate a struct from docopt command-line options.  You can also customise the map keys used when dumping a struct by passing VarNameFunc to Dump().  This library is released under the MIT Licence.
Keywords: configuration|environment-variables|envvars|mapping|settings|struct