Skip to content

Commit

Permalink
cmd/nm: use t.TempDir
Browse files Browse the repository at this point in the history
Change-Id: I6c1d148ae4c899142b160533d8bdf662494bcd7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/611039
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
  • Loading branch information
kolyshkin authored and gopherbot committed Sep 6, 2024
1 parent 2be9309 commit 29a3a39
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/cmd/nm/nm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ func TestNonGoExecs(t *testing.T) {

func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
t.Parallel()
tmpdir, err := os.MkdirTemp("", "TestGoExec")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
tmpdir := t.TempDir()

src := filepath.Join(tmpdir, "a.go")
file, err := os.Create(src)
Expand Down Expand Up @@ -200,16 +196,12 @@ func TestGoExec(t *testing.T) {

func testGoLib(t *testing.T, iscgo bool) {
t.Parallel()
tmpdir, err := os.MkdirTemp("", "TestGoLib")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
tmpdir := t.TempDir()

gopath := filepath.Join(tmpdir, "gopath")
libpath := filepath.Join(gopath, "src", "mylib")

err = os.MkdirAll(libpath, 0777)
err := os.MkdirAll(libpath, 0777)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 29a3a39

Please sign in to comment.