mirror of
https://github.com/golang/go
synced 2024-11-25 11:48:04 -07:00
encoding/binary: better example
leave that joke to Java. R=golang-dev, adg CC=golang-dev https://golang.org/cl/5695080
This commit is contained in:
parent
ce51e10749
commit
fa33fdbc7d
@ -25,9 +25,9 @@ func ExampleWrite() {
|
|||||||
func ExampleWrite_multi() {
|
func ExampleWrite_multi() {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
var data = []interface{}{
|
var data = []interface{}{
|
||||||
|
uint16(61374),
|
||||||
int8(-54),
|
int8(-54),
|
||||||
uint8(254),
|
uint8(254),
|
||||||
uint16(48826),
|
|
||||||
}
|
}
|
||||||
for _, v := range data {
|
for _, v := range data {
|
||||||
err := binary.Write(buf, binary.LittleEndian, v)
|
err := binary.Write(buf, binary.LittleEndian, v)
|
||||||
@ -36,7 +36,7 @@ func ExampleWrite_multi() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("%x", buf.Bytes())
|
fmt.Printf("%x", buf.Bytes())
|
||||||
// Output: cafebabe
|
// Output: beefcafe
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRead() {
|
func ExampleRead() {
|
||||||
|
Loading…
Reference in New Issue
Block a user