golang工具代码持续汇总
// int64 转字节数组 func IntToHex(num int64) []byte { buf := new(bytes.Buffer) err := binary.Write(buf, binary.BigEndian, num) if err != nil { log.Panic(err) } return buf.Bytes() }
// 时间戳 转为 []byte timeString := strconv.FormatInt(time.Now().Unix(), 2) timeBytes := []byte(timeString)