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 ...string) string
- func GetVar(key string, def ...interface{}) *gvar.Var
- func GetWithCmd(key string, def ...interface{}) *gvar.Var
- func Map() map[string]string
- func Remove(key ...string) error
- func Set(key, value string) error
- func SetMap(m map[string]string) 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 returns the value of the environment variable named by the <key>. It returns given <def> if the variable does not exist in the environment.
func GetVar ¶
GetVar 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>;
Types ¶
This section is empty.