Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithEnvVar ¶
func WithEnvVar(key, value string) func()
WithEnvVar sets the env variable to the given environment variable and returns a function to revert. If the value is empty, the environment variable will be unset.
func WithVar ¶
func WithVar(dst, src interface{}) func()
WithVar sets the given var to the src value and returns a function to revert to the original state. The type of `dst` has to be a settable pointer. The value of `src` has to be assignable to the type of `dst`.
Example usage:
v := "foo" defer WithVar(&v, "bar")()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.