Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendOSArgs ¶
func AppendOSArgs(args ...string) func()
AppendOSArgs will append os.Args with the given values. You can reset the args back to their previous value by executing the returned function.
func SetEnvVar ¶
SetEnvVar will set the given environment variable value. You can reset the env var back to it's previous value by executing the returned function.
Example ¶
package main import ( "fmt" "github.com/tomwright/tmpenv" "os" ) func main() { fmt.Println(os.Getenv("XYZ")) // "" reset := tmpenv.SetEnvVar("XYZ", "123") // Start tests that depend on XYZ fmt.Println(os.Getenv("XYZ")) // "123" // Stop tests that depend on XYZ reset() fmt.Println(os.Getenv("XYZ")) // "" }
Output: 123
func SetEnvVars ¶
SetEnvVars will set the given environment variables values. You can reset the env vars back to their previous value by executing the returned function.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.