将uint64 转为 []bype

func Uint64ToByte(num uint64) []byte{

    var buffer bytes.Buffer

    err := binary.Write(&buffer,binary.BigEndian,num);
    if err != nil {
        log.Panic(err)
    }

    return buffer.Bytes()
}

你可能感兴趣的:(将uint64 转为 []bype)