1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2025-10-04 04:31:00 +00:00

test: use t.TempDir

This was added in Go 1.15 and avoids polluting the host /tmp with test
directories if the test crashes or is forcefully killed.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai 2025-09-20 03:05:47 +10:00
parent d997335f30
commit f2b48a0e2f
No known key found for this signature in database
GPG key ID: 2897FAD2B7E9446F
5 changed files with 13 additions and 62 deletions

View file

@ -12,11 +12,10 @@ func TestWalk(t *testing.T) {
}
numEntries := countTypes(dh)
fh, err := os.CreateTemp("", "walk.")
fh, err := os.CreateTemp(t.TempDir(), "walk.")
if err != nil {
t.Fatal(err)
}
defer os.Remove(fh.Name())
defer fh.Close()
if _, err = dh.WriteTo(fh); err != nil {