]> Cypherpunks.ru repositories - gostls13.git/commitdiff
archive/tar: replace os.MkdirTemp with T.TempDir
authorManlio Perillo <manlio.perillo@gmail.com>
Tue, 13 Apr 2021 10:35:28 +0000 (12:35 +0200)
committerIan Lance Taylor <iant@golang.org>
Tue, 13 Apr 2021 21:06:12 +0000 (21:06 +0000)
Updates #45402

Change-Id: I296f8c676c68ed1e10b6ad1a17b5b23d2c395252
Reviewed-on: https://go-review.googlesource.com/c/go/+/309355
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/archive/tar/tar_test.go

index 91b38401b6c1030f05b81caabb5ac19faa271d25..e9fafc7cc70df5cd5f6308f42c87c6d577f6dabf 100644 (file)
@@ -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)