Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae3ad0a

Browse files
committedMar 19, 2021
all: update references to symbols moved from io/ioutil to io
1 parent 6704843 commit ae3ad0a

File tree

14 files changed

+22
-27
lines changed

14 files changed

+22
-27
lines changed
 

‎misc/android/go_android_exec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ func adbCopyGoroot() error {
276276
if err := syscall.Flock(int(stat.Fd()), syscall.LOCK_EX); err != nil {
277277
return err
278278
}
279-
s, err := ioutil.ReadAll(stat)
279+
s, err := io.ReadAll(stat)
280280
if err != nil {
281281
return err
282282
}

‎misc/cgo/testcarchive/testdata/libgo6/sigprof.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
package main
66

77
import (
8-
"io/ioutil"
8+
"io"
99
"runtime/pprof"
1010
)
1111

1212
import "C"
1313

1414
//export go_start_profile
1515
func go_start_profile() {
16-
pprof.StartCPUProfile(ioutil.Discard)
16+
pprof.StartCPUProfile(io.Discard)
1717
}
1818

1919
//export go_stop_profile

‎misc/cgo/testsanitizers/testdata/tsan9.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void spin() {
4444
import "C"
4545

4646
import (
47-
"io/ioutil"
47+
"io"
4848
"runtime/pprof"
4949
"time"
5050
)
@@ -60,7 +60,7 @@ func goSpin() {
6060
}
6161

6262
func main() {
63-
pprof.StartCPUProfile(ioutil.Discard)
63+
pprof.StartCPUProfile(io.Discard)
6464
go C.spin()
6565
goSpin()
6666
pprof.StopCPUProfile()

‎misc/linkcheck/linkcheck.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"errors"
1212
"flag"
1313
"fmt"
14-
"io/ioutil"
14+
"io"
1515
"log"
1616
"net/http"
1717
"os"
@@ -144,7 +144,7 @@ func doCrawl(url string) error {
144144
if res.StatusCode != 200 {
145145
return errors.New(res.Status)
146146
}
147-
slurp, err := ioutil.ReadAll(res.Body)
147+
slurp, err := io.ReadAll(res.Body)
148148
res.Body.Close()
149149
if err != nil {
150150
log.Fatalf("Error reading %s body: %v", url, err)

‎src/net/http/fs_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ func TestServeIndexHtml(t *testing.T) {
593593
if err != nil {
594594
t.Fatal(err)
595595
}
596-
b, err := ioutil.ReadAll(res.Body)
596+
b, err := io.ReadAll(res.Body)
597597
if err != nil {
598598
t.Fatal("reading Body:", err)
599599
}

‎src/testing/fstest/testfs.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"fmt"
1111
"io"
1212
"io/fs"
13-
"io/ioutil"
1413
"path"
1514
"reflect"
1615
"sort"
@@ -514,7 +513,7 @@ func (t *fsTester) checkFile(file string) {
514513
return
515514
}
516515

517-
data, err := ioutil.ReadAll(f)
516+
data, err := io.ReadAll(f)
518517
if err != nil {
519518
f.Close()
520519
t.errorf("%s: Open+ReadAll: %v", file, err)

‎test/bench/go1/gob_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"bytes"
1111
"encoding/gob"
1212
"encoding/json"
13-
"io/ioutil"
13+
"io"
1414
"log"
1515
"reflect"
1616
"testing"
@@ -73,7 +73,7 @@ func gobdec() {
7373
}
7474

7575
func gobenc() {
76-
if err := gob.NewEncoder(ioutil.Discard).Encode(&gobdata); err != nil {
76+
if err := gob.NewEncoder(io.Discard).Encode(&gobdata); err != nil {
7777
panic(err)
7878
}
7979
}

‎test/bench/go1/gzip_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"bytes"
1111
gz "compress/gzip"
1212
"io"
13-
"io/ioutil"
1413
"testing"
1514
)
1615

@@ -28,7 +27,7 @@ func init() {
2827
}
2928

3029
func gzip() {
31-
c := gz.NewWriter(ioutil.Discard)
30+
c := gz.NewWriter(io.Discard)
3231
if _, err := c.Write(jsongunz); err != nil {
3332
panic(err)
3433
}
@@ -42,7 +41,7 @@ func gunzip() {
4241
if err != nil {
4342
panic(err)
4443
}
45-
if _, err := io.Copy(ioutil.Discard, r); err != nil {
44+
if _, err := io.Copy(io.Discard, r); err != nil {
4645
panic(err)
4746
}
4847
r.Close()

‎test/bench/go1/http_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package go1
66

77
import (
88
"bytes"
9-
"io/ioutil"
9+
"io"
1010
"net/http"
1111
"net/http/httptest"
1212
"testing"
@@ -34,7 +34,7 @@ func BenchmarkHTTPClientServer(b *testing.B) {
3434
if err != nil {
3535
b.Fatal("Get:", err)
3636
}
37-
all, err := ioutil.ReadAll(res.Body)
37+
all, err := io.ReadAll(res.Body)
3838
if err != nil {
3939
b.Fatal("ReadAll:", err)
4040
}

‎test/bench/go1/json_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"encoding/base64"
1313
"encoding/json"
1414
"io"
15-
"io/ioutil"
1615
"testing"
1716
)
1817

@@ -26,7 +25,7 @@ func makeJsonBytes() []byte {
2625
r = bytes.NewReader(bytes.Replace(jsonbz2_base64, []byte{'\n'}, nil, -1))
2726
r = base64.NewDecoder(base64.StdEncoding, r)
2827
r = bzip2.NewReader(r)
29-
b, err := ioutil.ReadAll(r)
28+
b, err := io.ReadAll(r)
3029
if err != nil {
3130
panic(err)
3231
}

‎test/bench/go1/parser_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"go/parser"
1313
"go/token"
1414
"io"
15-
"io/ioutil"
1615
"strings"
1716
"testing"
1817
)
@@ -26,7 +25,7 @@ func makeParserBytes() []byte {
2625
r = strings.NewReader(parserbz2_base64)
2726
r = base64.NewDecoder(base64.StdEncoding, r)
2827
r = bzip2.NewReader(r)
29-
b, err := ioutil.ReadAll(r)
28+
b, err := io.ReadAll(r)
3029
if err != nil {
3130
panic(err)
3231
}

‎test/bench/go1/revcomp_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package go1
1010
import (
1111
"bufio"
1212
"bytes"
13-
"io/ioutil"
13+
"io"
1414
"testing"
1515
)
1616

@@ -35,7 +35,7 @@ var revCompTable = [256]uint8{
3535

3636
func revcomp(data []byte) {
3737
in := bufio.NewReader(bytes.NewBuffer(data))
38-
out := ioutil.Discard
38+
out := io.Discard
3939
buf := make([]byte, 1024*1024)
4040
line, err := in.ReadSlice('\n')
4141
for err == nil {

‎test/bench/go1/template_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package go1
99

1010
import (
1111
"bytes"
12-
"io/ioutil"
12+
"io"
1313
"strings"
1414
"testing"
1515
"text/template"
@@ -63,7 +63,7 @@ func init() {
6363
}
6464

6565
func tmplexec() {
66-
if err := tmpl.Execute(ioutil.Discard, &jsondata); err != nil {
66+
if err := tmpl.Execute(io.Discard, &jsondata); err != nil {
6767
panic(err)
6868
}
6969
}

‎test/stress/runstress.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"flag"
1313
"fmt"
1414
"io"
15-
"io/ioutil"
1615
"log"
1716
"math/rand"
1817
"net"
@@ -70,7 +69,7 @@ func stressNet() {
7069
if res.StatusCode != 200 {
7170
log.Fatalf("stressNet: Status code = %d", res.StatusCode)
7271
}
73-
n, err := io.Copy(ioutil.Discard, res.Body)
72+
n, err := io.Copy(io.Discard, res.Body)
7473
if err != nil {
7574
log.Fatalf("stressNet: io.Copy: %v", err)
7675
}

0 commit comments

Comments
 (0)
Please sign in to comment.