From 41a15a301319ec3a4be03eda90e9611b44701e9c Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Mon, 19 Aug 2013 16:22:31 +1000 Subject: [PATCH] go.tools/go/vcs: do not delete $TMPDIR during test runs The test would nuke the entire contents of os.TempDir on completion. This change corrects the code to use ioutil.TempDir. R=r, adg CC=golang-dev https://golang.org/cl/12796045 --- go/vcs/vcs_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/go/vcs/vcs_test.go b/go/vcs/vcs_test.go index 30e003cf5fd..7f1b88c7a06 100644 --- a/go/vcs/vcs_test.go +++ b/go/vcs/vcs_test.go @@ -5,6 +5,7 @@ package vcs import ( + "io/ioutil" "os" "path/filepath" "testing" @@ -50,7 +51,11 @@ func TestFromDir(t *testing.T) { } tests := make([]testStruct, len(vcsList)) - tempDir := os.TempDir() + tempDir, err := ioutil.TempDir("", "vcstest") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tempDir) for i, vcs := range vcsList { tests[i] = testStruct{ @@ -67,5 +72,4 @@ func TestFromDir(t *testing.T) { } os.RemoveAll(test.path) } - os.RemoveAll(tempDir) }