From: Mohit Agarwal Date: Tue, 8 Nov 2016 12:16:10 +0000 (+0530) Subject: os: cleanup directories created by TestLongPath X-Git-Tag: go1.8beta1~264 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3a3f672eda6f720f68950492a85254528ac53dad;p=gostls13.git os: cleanup directories created by TestLongPath Add tmpdir as a parameter to the closure otherwise the subsequent modifications to tmpdir causes only the last subdirectory to be removed. Additionally, add the missing argument for the t.Fatalf call. Change-Id: I3df53f9051f7ea40cf3f846d47d9cefe445e9b9d Reviewed-on: https://go-review.googlesource.com/32892 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- diff --git a/src/os/os_test.go b/src/os/os_test.go index 705c44d143..eb4454411f 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -1703,11 +1703,11 @@ func TestReadAtEOF(t *testing.T) { func TestLongPath(t *testing.T) { tmpdir := newDir("TestLongPath", t) - defer func() { - if err := RemoveAll(tmpdir); err != nil { + defer func(d string) { + if err := RemoveAll(d); err != nil { t.Fatalf("RemoveAll failed: %v", err) } - }() + }(tmpdir) for len(tmpdir) < 400 { tmpdir += "/dir3456789" } @@ -1751,7 +1751,7 @@ func TestLongPath(t *testing.T) { } } if err := Truncate(tmpdir+"/bar.txt", 0); err != nil { - t.Fatalf("Truncate failed: %v") + t.Fatalf("Truncate failed: %v", err) } } }