From 069983e5db99fa6b94401f971e9c19440615d233 Mon Sep 17 00:00:00 2001 From: Manlio Perillo Date: Tue, 13 Apr 2021 12:35:28 +0200 Subject: [PATCH] archive/tar: replace os.MkdirTemp with T.TempDir Updates #45402 Change-Id: I296f8c676c68ed1e10b6ad1a17b5b23d2c395252 Reviewed-on: https://go-review.googlesource.com/c/go/+/309355 Run-TryBot: Ian Lance Taylor Reviewed-by: Joe Tsai Reviewed-by: Ian Lance Taylor Trust: Joe Tsai TryBot-Result: Go Bot --- src/archive/tar/tar_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/archive/tar/tar_test.go b/src/archive/tar/tar_test.go index 91b38401b6c..e9fafc7cc70 100644 --- a/src/archive/tar/tar_test.go +++ b/src/archive/tar/tar_test.go @@ -262,16 +262,11 @@ func TestFileInfoHeaderDir(t *testing.T) { func TestFileInfoHeaderSymlink(t *testing.T) { testenv.MustHaveSymlink(t) - tmpdir, err := os.MkdirTemp("", "TestFileInfoHeaderSymlink") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpdir) + tmpdir := t.TempDir() link := filepath.Join(tmpdir, "link") target := tmpdir - err = os.Symlink(target, link) - if err != nil { + if err := os.Symlink(target, link); err != nil { t.Fatal(err) } fi, err := os.Lstat(link)