]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/binary: use bytes.Reader in read example
authorMathieu Lonjaret <mathieu.lonjaret@gmail.com>
Tue, 27 Aug 2013 13:32:24 +0000 (06:32 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 27 Aug 2013 13:32:24 +0000 (06:32 -0700)
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13274043

src/pkg/encoding/binary/example_test.go

index dec12ebf5d19d59aa6f102a4e1d84f00ac6d51de..067cf553beb967463f1545f983bfc7fd4824080c 100644 (file)
@@ -42,7 +42,7 @@ func ExampleWrite_multi() {
 func ExampleRead() {
        var pi float64
        b := []byte{0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40}
-       buf := bytes.NewBuffer(b)
+       buf := bytes.NewReader(b)
        err := binary.Read(buf, binary.LittleEndian, &pi)
        if err != nil {
                fmt.Println("binary.Read failed:", err)