Skip to content

Commit 45432b5

Browse files
tklausergopherbot
authored andcommitted
internal/socket, webdav: use testing.T.TempDir
It's available since Go 1.15 and go.mod currently specifies Go 1.18. Change-Id: Ia5ba22f5802f4af9fb6d3b6e7ee5a02ce3582e9a Reviewed-on: https://go-review.googlesource.com/c/net/+/643595 Auto-Submit: Tobias Klauser <[email protected]> Reviewed-by: David Chase <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 56691ee commit 45432b5

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

internal/socket/socket_test.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,7 @@ func main() {
445445
if runtime.Compiler == "gccgo" {
446446
t.Skip("skipping race test when built with gccgo")
447447
}
448-
dir, err := os.MkdirTemp("", "testrace")
449-
if err != nil {
450-
t.Fatalf("failed to create temp directory: %v", err)
451-
}
452-
defer os.RemoveAll(dir)
448+
dir := t.TempDir()
453449
goBinary := filepath.Join(runtime.GOROOT(), "bin", "go")
454450
t.Logf("%s version", goBinary)
455451
got, err := exec.Command(goBinary, "version").CombinedOutput()

webdav/file_test.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -517,12 +517,7 @@ func TestDir(t *testing.T) {
517517
t.Skip("see golang.org/issue/11453")
518518
}
519519

520-
td, err := os.MkdirTemp("", "webdav-test")
521-
if err != nil {
522-
t.Fatal(err)
523-
}
524-
defer os.RemoveAll(td)
525-
testFS(t, Dir(td))
520+
testFS(t, Dir(t.TempDir()))
526521
}
527522

528523
func TestMemFS(t *testing.T) {

0 commit comments

Comments
 (0)