1
0
mirror of https://github.com/golang/go synced 2024-09-23 21:20:13 -06:00

all: update references to symbols moved from io/ioutil to io

This commit is contained in:
KimMachineGun 2020-11-30 02:04:43 +09:00
parent 6704843202
commit ae3ad0ab21
14 changed files with 22 additions and 27 deletions

View File

@ -276,7 +276,7 @@ func adbCopyGoroot() error {
if err := syscall.Flock(int(stat.Fd()), syscall.LOCK_EX); err != nil {
return err
}
s, err := ioutil.ReadAll(stat)
s, err := io.ReadAll(stat)
if err != nil {
return err
}

View File

@ -5,7 +5,7 @@
package main
import (
"io/ioutil"
"io"
"runtime/pprof"
)
@ -13,7 +13,7 @@ import "C"
//export go_start_profile
func go_start_profile() {
pprof.StartCPUProfile(ioutil.Discard)
pprof.StartCPUProfile(io.Discard)
}
//export go_stop_profile

View File

@ -44,7 +44,7 @@ void spin() {
import "C"
import (
"io/ioutil"
"io"
"runtime/pprof"
"time"
)
@ -60,7 +60,7 @@ func goSpin() {
}
func main() {
pprof.StartCPUProfile(ioutil.Discard)
pprof.StartCPUProfile(io.Discard)
go C.spin()
goSpin()
pprof.StopCPUProfile()

View File

@ -11,7 +11,7 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
@ -144,7 +144,7 @@ func doCrawl(url string) error {
if res.StatusCode != 200 {
return errors.New(res.Status)
}
slurp, err := ioutil.ReadAll(res.Body)
slurp, err := io.ReadAll(res.Body)
res.Body.Close()
if err != nil {
log.Fatalf("Error reading %s body: %v", url, err)

View File

@ -593,7 +593,7 @@ func TestServeIndexHtml(t *testing.T) {
if err != nil {
t.Fatal(err)
}
b, err := ioutil.ReadAll(res.Body)
b, err := io.ReadAll(res.Body)
if err != nil {
t.Fatal("reading Body:", err)
}

View File

@ -10,7 +10,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"path"
"reflect"
"sort"
@ -514,7 +513,7 @@ func (t *fsTester) checkFile(file string) {
return
}
data, err := ioutil.ReadAll(f)
data, err := io.ReadAll(f)
if err != nil {
f.Close()
t.errorf("%s: Open+ReadAll: %v", file, err)

View File

@ -10,7 +10,7 @@ import (
"bytes"
"encoding/gob"
"encoding/json"
"io/ioutil"
"io"
"log"
"reflect"
"testing"
@ -73,7 +73,7 @@ func gobdec() {
}
func gobenc() {
if err := gob.NewEncoder(ioutil.Discard).Encode(&gobdata); err != nil {
if err := gob.NewEncoder(io.Discard).Encode(&gobdata); err != nil {
panic(err)
}
}

View File

@ -10,7 +10,6 @@ import (
"bytes"
gz "compress/gzip"
"io"
"io/ioutil"
"testing"
)
@ -28,7 +27,7 @@ func init() {
}
func gzip() {
c := gz.NewWriter(ioutil.Discard)
c := gz.NewWriter(io.Discard)
if _, err := c.Write(jsongunz); err != nil {
panic(err)
}
@ -42,7 +41,7 @@ func gunzip() {
if err != nil {
panic(err)
}
if _, err := io.Copy(ioutil.Discard, r); err != nil {
if _, err := io.Copy(io.Discard, r); err != nil {
panic(err)
}
r.Close()

View File

@ -6,7 +6,7 @@ package go1
import (
"bytes"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"
@ -34,7 +34,7 @@ func BenchmarkHTTPClientServer(b *testing.B) {
if err != nil {
b.Fatal("Get:", err)
}
all, err := ioutil.ReadAll(res.Body)
all, err := io.ReadAll(res.Body)
if err != nil {
b.Fatal("ReadAll:", err)
}

View File

@ -12,7 +12,6 @@ import (
"encoding/base64"
"encoding/json"
"io"
"io/ioutil"
"testing"
)
@ -26,7 +25,7 @@ func makeJsonBytes() []byte {
r = bytes.NewReader(bytes.Replace(jsonbz2_base64, []byte{'\n'}, nil, -1))
r = base64.NewDecoder(base64.StdEncoding, r)
r = bzip2.NewReader(r)
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
panic(err)
}

View File

@ -12,7 +12,6 @@ import (
"go/parser"
"go/token"
"io"
"io/ioutil"
"strings"
"testing"
)
@ -26,7 +25,7 @@ func makeParserBytes() []byte {
r = strings.NewReader(parserbz2_base64)
r = base64.NewDecoder(base64.StdEncoding, r)
r = bzip2.NewReader(r)
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
panic(err)
}

View File

@ -10,7 +10,7 @@ package go1
import (
"bufio"
"bytes"
"io/ioutil"
"io"
"testing"
)
@ -35,7 +35,7 @@ var revCompTable = [256]uint8{
func revcomp(data []byte) {
in := bufio.NewReader(bytes.NewBuffer(data))
out := ioutil.Discard
out := io.Discard
buf := make([]byte, 1024*1024)
line, err := in.ReadSlice('\n')
for err == nil {

View File

@ -9,7 +9,7 @@ package go1
import (
"bytes"
"io/ioutil"
"io"
"strings"
"testing"
"text/template"
@ -63,7 +63,7 @@ func init() {
}
func tmplexec() {
if err := tmpl.Execute(ioutil.Discard, &jsondata); err != nil {
if err := tmpl.Execute(io.Discard, &jsondata); err != nil {
panic(err)
}
}

View File

@ -12,7 +12,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"net"
@ -70,7 +69,7 @@ func stressNet() {
if res.StatusCode != 200 {
log.Fatalf("stressNet: Status code = %d", res.StatusCode)
}
n, err := io.Copy(ioutil.Discard, res.Body)
n, err := io.Copy(io.Discard, res.Body)
if err != nil {
log.Fatalf("stressNet: io.Copy: %v", err)
}