Skip to content

Commit

Permalink
all: update references to symbols moved from io/ioutil to io
Browse files Browse the repository at this point in the history
  • Loading branch information
KimMachineGun committed Nov 30, 2020
1 parent 4ce0a7c commit 8c4604e
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 28 deletions.
3 changes: 2 additions & 1 deletion doc/articles/wiki/wiki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main_test
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
Expand Down Expand Up @@ -141,7 +142,7 @@ func responseMustMatchFile(t *testing.T, r *http.Response, filename string) {
t.Helper()

defer r.Body.Close()
body, err := ioutil.ReadAll(r.Body)
body, err := io.ReadAll(r.Body)
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion misc/android/go_android_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions misc/cgo/testcarchive/testdata/libgo6/sigprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
package main

import (
"io/ioutil"
"io"
"runtime/pprof"
)

import "C"

//export go_start_profile
func go_start_profile() {
pprof.StartCPUProfile(ioutil.Discard)
pprof.StartCPUProfile(io.Discard)
}

//export go_stop_profile
Expand Down
4 changes: 2 additions & 2 deletions misc/cgo/testsanitizers/testdata/tsan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void spin() {
import "C"

import (
"io/ioutil"
"io"
"runtime/pprof"
"time"
)
Expand All @@ -60,7 +60,7 @@ func goSpin() {
}

func main() {
pprof.StartCPUProfile(ioutil.Discard)
pprof.StartCPUProfile(io.Discard)
go C.spin()
goSpin()
pprof.StopCPUProfile()
Expand Down
4 changes: 2 additions & 2 deletions misc/linkcheck/linkcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/net/http/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions src/testing/fstest/testfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"path"
"reflect"
"sort"
Expand Down Expand Up @@ -460,7 +459,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)
Expand Down
4 changes: 2 additions & 2 deletions test/bench/go1/gob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"bytes"
"encoding/gob"
"encoding/json"
"io/ioutil"
"io"
"log"
"reflect"
"testing"
Expand Down Expand Up @@ -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)
}
}
Expand Down
5 changes: 2 additions & 3 deletions test/bench/go1/gzip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"bytes"
gz "compress/gzip"
"io"
"io/ioutil"
"testing"
)

Expand All @@ -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)
}
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions test/bench/go1/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package go1

import (
"bytes"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions test/bench/go1/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"encoding/base64"
"encoding/json"
"io"
"io/ioutil"
"testing"
)

Expand All @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions test/bench/go1/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"go/parser"
"go/token"
"io"
"io/ioutil"
"strings"
"testing"
)
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions test/bench/go1/revcomp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package go1
import (
"bufio"
"bytes"
"io/ioutil"
"io"
"testing"
)

Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions test/bench/go1/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package go1

import (
"bytes"
"io/ioutil"
"io"
"strings"
"testing"
"text/template"
Expand Down Expand Up @@ -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)
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/stress/runstress.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"net"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 8c4604e

Please sign in to comment.