From 640e9b64f8cb2b700589bcf3c0cf060410202ee3 Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Wed, 19 Aug 2020 16:54:17 +0800 Subject: [PATCH] cleanup tempdir properly for localpath_test 'path' could be changed during the test Signed-off-by: Li Zhijian --- pkg/minikube/localpath/localpath_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/minikube/localpath/localpath_test.go b/pkg/minikube/localpath/localpath_test.go index 00f52d09da..782ae87c97 100644 --- a/pkg/minikube/localpath/localpath_test.go +++ b/pkg/minikube/localpath/localpath_test.go @@ -33,12 +33,12 @@ func TestReplaceWinDriveLetterToVolumeName(t *testing.T) { if err != nil { t.Fatalf("Error make tmp directory: %v", err) } - defer func() { //clean up tempdir + defer func(path string) { //clean up tempdir err := os.RemoveAll(path) if err != nil { t.Errorf("failed to clean up temp folder %q", path) } - }() + }(path) if runtime.GOOS != "windows" { // Replace to fake func.