mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: replace package ioutil with os and io in src
For #45557 Change-Id: I56824135d86452603dd4ed4bab0e24c201bb0683 Reviewed-on: https://go-review.googlesource.com/c/go/+/426257 Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Andy Pan <panjf2000@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
1e7e160d07
commit
f8c659b62f
67 changed files with 255 additions and 290 deletions
|
|
@ -18,7 +18,6 @@ import (
|
|||
"go/token"
|
||||
"internal/buildcfg"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
|
|
@ -345,7 +344,7 @@ func main() {
|
|||
input = aname
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadFile(input)
|
||||
b, err := os.ReadFile(input)
|
||||
if err != nil {
|
||||
fatalf("%s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
|
@ -21,13 +20,13 @@ func run(stdin []byte, argv []string) (stdout, stderr []byte, ok bool) {
|
|||
// Some compilers have trouble with standard input.
|
||||
// Others have trouble with -xc.
|
||||
// Avoid both problems by writing a file with a .c extension.
|
||||
f, err := ioutil.TempFile("", "cgo-gcc-input-")
|
||||
f, err := os.CreateTemp("", "cgo-gcc-input-")
|
||||
if err != nil {
|
||||
fatalf("%s", err)
|
||||
}
|
||||
name := f.Name()
|
||||
f.Close()
|
||||
if err := ioutil.WriteFile(name+".c", stdin, 0666); err != nil {
|
||||
if err := os.WriteFile(name+".c", stdin, 0666); err != nil {
|
||||
os.Remove(name)
|
||||
fatalf("%s", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue