func main() {
addr:=int32(33334)
buffer := bytes.NewBuffer(nil)
binary.Write(buffer,binary.BigEndian,&addr)
glog.Info(buffer.Bytes())
}
注意必须加int32
type (bool, int8, uint8, int16, float32, complex64, …)
使用binary包时,必须使用明确的长度确定的类型,可以用int32,但别用int。