diff options
author | Russ Cox <rsc@golang.org> | 2020-10-29 14:17:47 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-12-09 19:12:23 +0000 |
commit | 4f1b0a44cb46f3df28f5ef82e5769ebeac1bc493 (patch) | |
tree | c186cc25257b05fcb21cd8c1f1ee5961ebef6eb3 /src/os/exec/lp_windows_test.go | |
parent | 5627a4dc3013fed02c4b8097413643b682cac276 (diff) | |
download | go-4f1b0a44cb46f3df28f5ef82e5769ebeac1bc493.tar.gz go-4f1b0a44cb46f3df28f5ef82e5769ebeac1bc493.zip |
all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTemp
As part of #42026, these helpers from io/ioutil were moved to os.
(ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.)
Update the Go tree to use the preferred names.
As usual, code compiled with the Go 1.4 bootstrap toolchain
and code vendored from other sources is excluded.
ReadDir changes are in a separate CL, because they are not a
simple search and replace.
For #42026.
Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/266365
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/os/exec/lp_windows_test.go')
-rw-r--r-- | src/os/exec/lp_windows_test.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/os/exec/lp_windows_test.go b/src/os/exec/lp_windows_test.go index 59b5f1c2c7..c6f3d5d406 100644 --- a/src/os/exec/lp_windows_test.go +++ b/src/os/exec/lp_windows_test.go @@ -11,7 +11,6 @@ import ( "fmt" "internal/testenv" "io" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -307,7 +306,7 @@ var lookPathTests = []lookPathTest{ } func TestLookPath(t *testing.T) { - tmp, err := ioutil.TempDir("", "TestLookPath") + tmp, err := os.MkdirTemp("", "TestLookPath") if err != nil { t.Fatal("TempDir failed: ", err) } @@ -504,7 +503,7 @@ var commandTests = []commandTest{ } func TestCommand(t *testing.T) { - tmp, err := ioutil.TempDir("", "TestCommand") + tmp, err := os.MkdirTemp("", "TestCommand") if err != nil { t.Fatal("TempDir failed: ", err) } @@ -529,7 +528,7 @@ func TestCommand(t *testing.T) { func buildPrintPathExe(t *testing.T, dir string) string { const name = "printpath" srcname := name + ".go" - err := ioutil.WriteFile(filepath.Join(dir, srcname), []byte(printpathSrc), 0644) + err := os.WriteFile(filepath.Join(dir, srcname), []byte(printpathSrc), 0644) if err != nil { t.Fatalf("failed to create source: %v", err) } |