diff options
| author | Kir Kolyshkin <kolyshkin@gmail.com> | 2024-08-29 23:22:21 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-09-03 20:16:07 +0000 |
| commit | 1ae6b9e31b952ad7090406475b2b0eb0e8804fcd (patch) | |
| tree | 948cd371d9babab4af23115db0cecc3dc6773f43 /src/syscall/syscall_linux_test.go | |
| parent | 763781c6ec92fceeb530167bc41985b865516f3a (diff) | |
| download | go-1ae6b9e31b952ad7090406475b2b0eb0e8804fcd.tar.xz | |
syscall: use t.TempDir in tests
Change-Id: Ibeb00306ee8f038c11f261abd99c05324bf2ab51
Reviewed-on: https://go-review.googlesource.com/c/go/+/609837
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/syscall/syscall_linux_test.go')
| -rw-r--r-- | src/syscall/syscall_linux_test.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/syscall/syscall_linux_test.go b/src/syscall/syscall_linux_test.go index 43c0ba0ce3..a150ab15be 100644 --- a/src/syscall/syscall_linux_test.go +++ b/src/syscall/syscall_linux_test.go @@ -213,12 +213,8 @@ func TestSyscallNoError(t *testing.T) { } // Copy the test binary to a location that a non-root user can read/execute - // after we drop privileges - tempDir, err := os.MkdirTemp("", "TestSyscallNoError") - if err != nil { - t.Fatalf("cannot create temporary directory: %v", err) - } - defer os.RemoveAll(tempDir) + // after we drop privileges. + tempDir := t.TempDir() os.Chmod(tempDir, 0755) tmpBinary := filepath.Join(tempDir, filepath.Base(os.Args[0])) |
