fix: handle nil map issue

This commit is contained in:
Jose Diaz-Gonzalez committed 2023-01-21 17:26:52 -05:00
1 parent 91975c5bfe
commit 1a498b0b76
1 file changed
+1 -1
+1 -1
View File
@@ -76,7 +76,7 @@ func CommandUsage(helpHeader string, helpContent string) {
// EnvWrap wraps a func with a setenv call and resets the value at the end // EnvWrap wraps a func with a setenv call and resets the value at the end
func EnvWrap(fn func() error, environ map[string]string) error { func EnvWrap(fn func() error, environ map[string]string) error {
var oldEnviron map[string]string oldEnviron := map[string]string{}
for key, value := range environ { for key, value := range environ {
oldEnviron[key] = os.Getenv(key) oldEnviron[key] = os.Getenv(key)
if err := os.Setenv(key, value); err != nil { if err := os.Setenv(key, value); err != nil {