]> Cypherpunks.ru repositories - gostls13.git/commitdiff
io/fs: use testing.T.TempDir in TestWalkDir
authorTobias Klauser <tklauser@distanz.ch>
Sat, 13 Mar 2021 17:00:17 +0000 (18:00 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Sat, 13 Mar 2021 18:35:01 +0000 (18:35 +0000)
Change-Id: I805ad51332e4efe27d47f6c6e3b0af945e0d4aa0
Reviewed-on: https://go-review.googlesource.com/c/go/+/301489
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
src/io/fs/walk_test.go

index ebc4e50fb319deaa05241ab84a04266742a0d08e..5e127e71cd96da16f324b6cb90a7e185cc61bc87 100644 (file)
@@ -6,7 +6,6 @@ package fs_test
 
 import (
        . "io/fs"
-       "io/ioutil"
        "os"
        pathpkg "path"
        "testing"
@@ -96,11 +95,7 @@ func mark(entry DirEntry, err error, errors *[]error, clear bool) error {
 }
 
 func TestWalkDir(t *testing.T) {
-       tmpDir, err := ioutil.TempDir("", "TestWalk")
-       if err != nil {
-               t.Fatal("creating temp dir:", err)
-       }
-       defer os.RemoveAll(tmpDir)
+       tmpDir := t.TempDir()
 
        origDir, err := os.Getwd()
        if err != nil {