Commit d5c806d5 authored by Mathieu Lonjaret's avatar Mathieu Lonjaret Committed by Brad Fitzpatrick

encoding/binary: use bytes.Reader in read example

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13274043
parent 11320fa5
...@@ -42,7 +42,7 @@ func ExampleWrite_multi() { ...@@ -42,7 +42,7 @@ func ExampleWrite_multi() {
func ExampleRead() { func ExampleRead() {
var pi float64 var pi float64
b := []byte{0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40} 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) err := binary.Read(buf, binary.LittleEndian, &pi)
if err != nil { if err != nil {
fmt.Println("binary.Read failed:", err) fmt.Println("binary.Read failed:", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment