Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockEnvvarsBackend ¶
MockEnvvarsBackend is a backend for envvars that uses the OS envvars
func NewMockEnvvarsBackend ¶
func NewMockEnvvarsBackend() *MockEnvvarsBackend
func (*MockEnvvarsBackend) Environ ¶
func (b *MockEnvvarsBackend) Environ() []string
Environ returns a copy of strings representing the environment, in the form "key=value"
func (*MockEnvvarsBackend) Getenv ¶
func (b *MockEnvvarsBackend) Getenv(key string) string
Getenv retrieves the value of the environment variable named by the key. It returns the value, which will be empty if the variable is not present. To distinguish between an empty value and an unset value, use LookupEnv
func (*MockEnvvarsBackend) LookupEnv ¶
func (b *MockEnvvarsBackend) LookupEnv(key string) (string, bool)
LookupEnv retrieves the value of the environment variable named by the key. If the variable is set the value (which may be empty) is returned and the boolean is true. Otherwise the returned value will be empty and the boolean will be false
func (*MockEnvvarsBackend) Setenv ¶
func (b *MockEnvvarsBackend) Setenv(key, value string)
Setenv sets the value of the environment variable named by the key. It returns an error, if any
type OSEnvvarsBackend ¶
type OSEnvvarsBackend struct{}
OSEnvvarsBackend is a backend for envvars that uses the OS envvars
func NewOSEnvvarsBackend ¶
func NewOSEnvvarsBackend() *OSEnvvarsBackend
func (*OSEnvvarsBackend) Environ ¶
func (b *OSEnvvarsBackend) Environ() []string
Environ returns a copy of strings representing the environment, in the form "key=value"
func (*OSEnvvarsBackend) Getenv ¶
func (b *OSEnvvarsBackend) Getenv(key string) string
Getenv retrieves the value of the environment variable named by the key. It returns the value, which will be empty if the variable is not present. To distinguish between an empty value and an unset value, use LookupEnv
func (*OSEnvvarsBackend) LookupEnv ¶
func (b *OSEnvvarsBackend) LookupEnv(key string) (string, bool)
LookupEnv retrieves the value of the environment variable named by the key. If the variable is set the value (which may be empty) is returned and the boolean is true. Otherwise the returned value will be empty and the boolean will be false
func (*OSEnvvarsBackend) Setenv ¶
func (b *OSEnvvarsBackend) Setenv(key, value string) error
Setenv sets the value of the environment variable named by the key. It returns an error, if any
func (*OSEnvvarsBackend) Unsetenv ¶
func (b *OSEnvvarsBackend) Unsetenv(key string) error
Unsetenv unsets a single environment variable