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

cmd/cgo/internal/testsanitizers: use t.TempDir

Change-Id: I6b2c25ab045aaec8bb6c25511b12d178d155fc25
Reviewed-on: https://go-review.googlesource.com/c/go/+/630338
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Ian Lance Taylor 2024-11-20 14:21:33 -08:00 committed by Gopher Robot
parent f96987888f
commit a9428eab40

View File

@ -563,12 +563,7 @@ func (d *tempDir) Join(name string) string {
}
func newTempDir(t *testing.T) *tempDir {
t.Helper()
dir, err := os.MkdirTemp("", filepath.Dir(t.Name()))
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
return &tempDir{base: dir}
return &tempDir{base: t.TempDir()}
}
// hangProneCmd returns an exec.Cmd for a command that is likely to hang.