diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-23 09:57:37 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-30 15:13:24 -0800 |
commit | cfcbb4227fb20191e04eb8d7766ae6202f526afd (patch) | |
tree | e2effea96f6f204451779f044415c2385e45042b /libgo/go/bytes | |
parent | 0696141107d61483f38482b941549959a0d7f613 (diff) | |
download | gcc-cfcbb4227fb20191e04eb8d7766ae6202f526afd.zip gcc-cfcbb4227fb20191e04eb8d7766ae6202f526afd.tar.gz gcc-cfcbb4227fb20191e04eb8d7766ae6202f526afd.tar.bz2 |
libgo: update to Go1.16beta1 release
This does not yet include support for the //go:embed directive added
in this release.
* Makefile.am (check-runtime): Don't create check-runtime-dir.
(mostlyclean-local): Don't remove check-runtime-dir.
(check-go-tool, check-vet): Copy in go.mod and modules.txt.
(check-cgo-test, check-carchive-test): Add go.mod file.
* Makefile.in: Regenerate.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280172
Diffstat (limited to 'libgo/go/bytes')
-rw-r--r-- | libgo/go/bytes/example_test.go | 7 | ||||
-rw-r--r-- | libgo/go/bytes/reader_test.go | 9 |
2 files changed, 11 insertions, 5 deletions
diff --git a/libgo/go/bytes/example_test.go b/libgo/go/bytes/example_test.go index 5ba7077..ae93202 100644 --- a/libgo/go/bytes/example_test.go +++ b/libgo/go/bytes/example_test.go @@ -30,6 +30,13 @@ func ExampleBuffer_reader() { // Output: Gophers rule! } +func ExampleBuffer_Bytes() { + buf := bytes.Buffer{} + buf.Write([]byte{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}) + os.Stdout.Write(buf.Bytes()) + // Output: hello world +} + func ExampleBuffer_Grow() { var b bytes.Buffer b.Grow(64) diff --git a/libgo/go/bytes/reader_test.go b/libgo/go/bytes/reader_test.go index d799e03..8baac50 100644 --- a/libgo/go/bytes/reader_test.go +++ b/libgo/go/bytes/reader_test.go @@ -8,7 +8,6 @@ import ( . "bytes" "fmt" "io" - "io/ioutil" "sync" "testing" ) @@ -235,7 +234,7 @@ func TestReaderCopyNothing(t *testing.T) { type justWriter struct { io.Writer } - discard := justWriter{ioutil.Discard} // hide ReadFrom + discard := justWriter{io.Discard} // hide ReadFrom var with, withOut nErr with.n, with.err = io.Copy(discard, NewReader(nil)) @@ -248,7 +247,7 @@ func TestReaderCopyNothing(t *testing.T) { // tests that Len is affected by reads, but Size is not. func TestReaderLenSize(t *testing.T) { r := NewReader([]byte("abc")) - io.CopyN(ioutil.Discard, r, 1) + io.CopyN(io.Discard, r, 1) if r.Len() != 2 { t.Errorf("Len = %d; want 2", r.Len()) } @@ -268,7 +267,7 @@ func TestReaderReset(t *testing.T) { if err := r.UnreadRune(); err == nil { t.Errorf("UnreadRune: expected error, got nil") } - buf, err := ioutil.ReadAll(r) + buf, err := io.ReadAll(r) if err != nil { t.Errorf("ReadAll: unexpected error: %v", err) } @@ -314,7 +313,7 @@ func TestReaderZero(t *testing.T) { t.Errorf("UnreadRune: got nil, want error") } - if n, err := (&Reader{}).WriteTo(ioutil.Discard); n != 0 || err != nil { + if n, err := (&Reader{}).WriteTo(io.Discard); n != 0 || err != nil { t.Errorf("WriteTo: got %d, %v; want 0, nil", n, err) } } |