Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get return the value of an environment-variable.
For example:
tcpport, found := env.Get[uint16]("PORT")
Or, for example:
shell, found := env.Get[string]("SHELL")
Note that the 2nd return value will be `false` if the environment-variable doesn't exist, or if the environment variable exists but its value is not compatible with the type.
See Type for a list of permissible types.
func GetElse ¶
GetElse return the value of an environment-variable, if it exists and whose value is parsable to the type, else it returns the `alt` value.
For example:
tcpport := env.GetElse[uint16]("PORT", 8080)
Or, for example:
shell, found := env.GetElse[string]("SHELL", "/bin/bash")
Note that the 2nd return parameter is the alternative value.
See Type for a list of permissible types.
Types ¶
Click to show internal directories.
Click to hide internal directories.