Commit 9cce08d7 authored by Tom Thorogood's avatar Tom Thorogood Committed by Brad Fitzpatrick

cmd/go/internal/renameio,runtime: avoid leaking temp directory in test

TestWriteFileModeAppliesUmask and TestVectoredHandlerDontCrashOnLibrary
could both leak /tmp/go-build-* directories which isn't very friendly.

Change-Id: Ibee9c33d49ad48958fae4df73853b82d92314bf0
GitHub-Last-Rev: 814e2fa4bb4e4fe9c00b6d465313ce35c7ab4e32
GitHub-Pull-Request: golang/go#34253
Reviewed-on: https://go-review.googlesource.com/c/go/+/194880
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 90e0b40a
......@@ -19,6 +19,7 @@ func TestWriteFileModeAppliesUmask(t *testing.T) {
if err != nil {
t.Fatalf("Failed to create temporary directory: %v", err)
}
defer os.RemoveAll(dir)
const mode = 0644
const umask = 0007
......@@ -29,7 +30,6 @@ func TestWriteFileModeAppliesUmask(t *testing.T) {
if err != nil {
t.Fatalf("Failed to write file: %v", err)
}
defer os.RemoveAll(dir)
fi, err := os.Stat(file)
if err != nil {
......
......@@ -28,7 +28,7 @@ func TestVectoredHandlerDontCrashOnLibrary(t *testing.T) {
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
defer os.Remove(dir)
defer os.RemoveAll(dir)
// build go dll
dll := filepath.Join(dir, "testwinlib.dll")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment