1
0
mirror of https://github.com/golang/go synced 2024-11-22 15:54:52 -07:00

text/template: replace os.MkdirTemp with T.TempDir

Updates #45402

Change-Id: I9d55191c4021387b771550b5c93c91806f694aa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/309351
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Manlio Perillo 2021-04-12 22:24:01 +02:00 committed by Ian Lance Taylor
parent cccd3ba912
commit c27991bf5b

View File

@ -39,11 +39,7 @@ func main() {
t.Used()
}
`
td, err := os.MkdirTemp("", "text_template_TestDeadCodeElimination")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(td)
td := t.TempDir()
if err := os.WriteFile(filepath.Join(td, "x.go"), []byte(prog), 0644); err != nil {
t.Fatal(err)