Documentation
¶
Overview ¶
Package osext contains extensions to the standard library package "os".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetenvBool ¶
GetenvBool returns true if and only if the environment variable with the given key exists and contains a string that strconv.ParseBool() recognizes as true. Non-existent or malformed values will be coerced into "false".
This method is commonly used for optional behavior flags, e.g. to activate debug logging.
func GetenvOrDefault ¶
GetenvOrDefault returns os.Getenv(key), except that if the environment variable is not set, the given default value will be returned instead.
func MustGetenv ¶
NeedGetenv returns os.Getenv(key), or panics if the environment variable is not set.
func NeedGetenv ¶
NeedGetenv returns os.Getenv(key), or an error if the environment variable is not set.
Types ¶
type MissingEnvError ¶
type MissingEnvError struct {
Key string
}
MissingEnvError is an error that occurs when an required environment variable was not present.
func (MissingEnvError) Error ¶
func (e MissingEnvError) Error() string
Error implements the builtin/error interface.