aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Agarwal <mohit@sdf.org>2016-11-08 17:46:10 +0530
committerIan Lance Taylor <iant@golang.org>2016-11-08 15:41:59 +0000
commit3a3f672eda6f720f68950492a85254528ac53dad (patch)
treeea7f511b03b5fa5eabbbfb75b3ea3c381256ee12
parent8a2a999311c22079c3b9f2e6fac2bbd38435a7ab (diff)
downloadgo-3a3f672eda6f720f68950492a85254528ac53dad.tar.gz
go-3a3f672eda6f720f68950492a85254528ac53dad.zip
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 <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/os/os_test.go8
1 files changed, 4 insertions, 4 deletions
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)
}
}
}