envctl

Go package providing test helper functions to temporarily change and restore environment variables.

Go Reference GitHub tag (latest SemVer) Actions Status Coverage GitHub issues GitHub pull requests License Status

os.Setenv("PORT", "8080")

envctl.With(map[string]string{"BIND": "0.0.0.0", "PORT": "3000"}, func() {
	fmt.Println(os.Getenv("BIND") + ":" + os.Getenv("PORT"))
})

fmt.Println(os.Getenv("BIND") + ":" + os.Getenv("PORT"))
0.0.0.0:3000
:8080

Documentation

Please see the Go Reference for documentation and examples.

Benchmarks

Benchmark reports and graphs are available here: https://jimeh.me/envctl/dev/bench/

License

MIT

Description
Go package providing test helper functions to temporarily change and restore environment variables.
Readme MIT 138 KiB
Languages
Go 76.5%
Makefile 23.5%