I got the runtime error message Write T1 binary.Read: invalid type main.T1
package main
import (
"encoding/binary"
"net"
)
type T1 struct {
f1 [5]byte
f2 int
}
func main() {
conn, _ := net.Dial("tcp", ":12345")
l1 := T1{[5]byte{'a', 'b', 'c', 'd', 'e'}, 1234}
binary.Write(conn, binary.BigEndian, &l1)
}
I wish to use the endian auto convert function, how could I do? By the way, is there more efficient way?