Standard library / encoding/binary
encoding/binary.AppendByteOrder
Interface for appending 16-, 32- and 64-bit integers to a slice, returning the extended slice. Expected stdout: '090102\n'.
Formal Syntax & Structure
go syntaxgo
type AppendByteOrder interface { AppendUint16([]byte, uint16) []byte AppendUint32([]byte, uint32) []byte AppendUint64([]byte, uint64) []byte String() string}Working Example
Example Snippetgo
package main
import ( "encoding/binary" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { var order binary.AppendByteOrder = binary.BigEndian fmt.Printf("%x\n", order.AppendUint16([]byte{9}, 258))}