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:
parent
11320fa500
commit
d5c806d581
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user