MCPcopy Create free account
hub / github.com/cli/cli / unsetEnv

Function unsetEnv

git/test.go:66–84  ·  view source on GitHub ↗
(t *testing.T, name string)

Source from the content-addressed store, hash-verified

64}
65
66func unsetEnv(t *testing.T, name string) {
67 t.Helper()
68
69 value, found := os.LookupEnv(name)
70 if err := os.Unsetenv(name); err != nil {
71 t.Fatalf("failed to unset %s: %v", name, err)
72 }
73 t.Cleanup(func() {
74 var err error
75 if found {
76 err = os.Setenv(name, value)
77 } else {
78 err = os.Unsetenv(name)
79 }
80 if err != nil {
81 t.Errorf("failed to restore %s: %v", name, err)
82 }
83 })
84}

Callers 1

IsolateConfigFunction · 0.85

Calls 2

HelperMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected