Documentation ¶
Overview ¶
Package genv provides operations for environment variables of system.
Index ¶
- func All() []string
- func Build(m map[string]string) []string
- func Contains(key string) bool
- func Get(key string, def ...interface{}) *gvar.Var
- func GetWithCmd(key string, def ...interface{}) *gvar.Var
- func Map() map[string]string
- func MustRemove(key ...string)
- func MustSet(key, value string)
- func Remove(key ...string) (err error)
- func Set(key, value string) (err error)
- func SetMap(m map[string]string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All() []string
All returns a copy of strings representing the environment, in the form "key=value".
func Get ¶
Get creates and returns a Var with the value of the environment variable named by the `key`. It uses the given `def` if the variable does not exist in the environment.
func GetWithCmd ¶
GetWithCmd returns the environment value specified `key`. If the environment value does not exist, then it retrieves and returns the value from command line options. It returns the default value `def` if none of them exists.
Fetching Rules: 1. Environment arguments are in uppercase format, eg: GF_<package name>_<variable name>; 2. Command line arguments are in lowercase format, eg: gf.<package name>.<variable name>;
func MustRemove ¶
func MustRemove(key ...string)
MustRemove performs as Remove, but it panics if any error occurs.
func MustSet ¶
func MustSet(key, value string)
MustSet performs as Set, but it panics if any error occurs.
Types ¶
This section is empty.