From ebc681be05e80dc11d50b09b0d219f46e83fb75c Mon Sep 17 00:00:00 2001 From: Sam Coe Date: Mon, 26 Sep 2022 13:37:34 +0400 Subject: [PATCH] Replace os.Setenv with t.Setenv (#6345) --- internal/config/stub.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/config/stub.go b/internal/config/stub.go index bbed1d763..0fed79cf5 100644 --- a/internal/config/stub.go +++ b/internal/config/stub.go @@ -72,9 +72,7 @@ func NewFromString(cfgStr string) *ConfigMock { func StubWriteConfig(t *testing.T) func(io.Writer, io.Writer) { t.Helper() tempDir := t.TempDir() - old := os.Getenv("GH_CONFIG_DIR") - os.Setenv("GH_CONFIG_DIR", tempDir) - t.Cleanup(func() { os.Setenv("GH_CONFIG_DIR", old) }) + t.Setenv("GH_CONFIG_DIR", tempDir) return func(wc io.Writer, wh io.Writer) { config, err := os.Open(filepath.Join(tempDir, "config.yml")) if err != nil {