1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:10:22 -07:00

debug/pe: replace os.MkdirTemp with T.TempDir

Updates #45402

Change-Id: I3d83a66270ca38e82d6bb7f8a1367af3d5343a98
Reviewed-on: https://go-review.googlesource.com/c/go/+/309352
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Manlio Perillo 2021-04-12 22:49:07 +02:00 committed by Ian Lance Taylor
parent c27991bf5b
commit 3d5e3a15f6

View File

@ -353,11 +353,7 @@ func testDWARF(t *testing.T, linktype int) {
}
testenv.MustHaveGoRun(t)
tmpdir, err := os.MkdirTemp("", "TestDWARF")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
tmpdir := t.TempDir()
src := filepath.Join(tmpdir, "a.go")
file, err := os.Create(src)
@ -472,11 +468,7 @@ func TestBSSHasZeros(t *testing.T) {
t.Skip("skipping test: gcc is missing")
}
tmpdir, err := os.MkdirTemp("", "TestBSSHasZeros")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
tmpdir := t.TempDir()
srcpath := filepath.Join(tmpdir, "a.c")
src := `
@ -596,15 +588,10 @@ func TestBuildingWindowsGUI(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("skipping windows only test")
}
tmpdir, err := os.MkdirTemp("", "TestBuildingWindowsGUI")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
tmpdir := t.TempDir()
src := filepath.Join(tmpdir, "a.go")
err = os.WriteFile(src, []byte(`package main; func main() {}`), 0644)
if err != nil {
if err := os.WriteFile(src, []byte(`package main; func main() {}`), 0644); err != nil {
t.Fatal(err)
}
exe := filepath.Join(tmpdir, "a.exe")