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/math | |
| parent | 5627a4dc3013fed02c4b8097413643b682cac276 (diff) | |
| download | go-4f1b0a44cb46f3df28f5ef82e5769ebeac1bc493.tar.xz | |
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/math')
| -rw-r--r-- | src/math/big/link_test.go | 4 | ||||
| -rw-r--r-- | src/math/bits/make_examples.go | 4 | ||||
| -rw-r--r-- | src/math/bits/make_tables.go | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/math/big/link_test.go b/src/math/big/link_test.go index 2212bd444f..42f9cefca0 100644 --- a/src/math/big/link_test.go +++ b/src/math/big/link_test.go @@ -7,7 +7,7 @@ package big import ( "bytes" "internal/testenv" - "io/ioutil" + "os" "os/exec" "path/filepath" "testing" @@ -27,7 +27,7 @@ func TestLinkerGC(t *testing.T) { import _ "math/big" func main() {} `) - if err := ioutil.WriteFile(goFile, file, 0644); err != nil { + if err := os.WriteFile(goFile, file, 0644); err != nil { t.Fatal(err) } cmd := exec.Command(goBin, "build", "-o", "x.exe", "x.go") diff --git a/src/math/bits/make_examples.go b/src/math/bits/make_examples.go index cd81cd6c4d..1d3ad53fe6 100644 --- a/src/math/bits/make_examples.go +++ b/src/math/bits/make_examples.go @@ -11,9 +11,9 @@ package main import ( "bytes" "fmt" - "io/ioutil" "log" "math/bits" + "os" ) const header = `// Copyright 2017 The Go Authors. All rights reserved. @@ -106,7 +106,7 @@ func main() { } } - if err := ioutil.WriteFile("example_test.go", w.Bytes(), 0666); err != nil { + if err := os.WriteFile("example_test.go", w.Bytes(), 0666); err != nil { log.Fatal(err) } } diff --git a/src/math/bits/make_tables.go b/src/math/bits/make_tables.go index ff2fe2e385..b068d5e0e3 100644 --- a/src/math/bits/make_tables.go +++ b/src/math/bits/make_tables.go @@ -13,8 +13,8 @@ import ( "fmt" "go/format" "io" - "io/ioutil" "log" + "os" ) var header = []byte(`// Copyright 2017 The Go Authors. All rights reserved. @@ -40,7 +40,7 @@ func main() { log.Fatal(err) } - err = ioutil.WriteFile("bits_tables.go", out, 0666) + err = os.WriteFile("bits_tables.go", out, 0666) if err != nil { log.Fatal(err) } |
