1
0
mirror of https://github.com/golang/go synced 2024-11-17 14:04:48 -07:00

encoding/binary: use bytes.Reader in read example

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/13274043
This commit is contained in:
Mathieu Lonjaret 2013-08-27 06:32:24 -07:00 committed by Brad Fitzpatrick
parent 11320fa500
commit d5c806d581

View 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)