1 Star 1 Fork 1

xiaoyutab / xgotool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
uuid.go 303 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiaoyutab 提交于 2023-12-18 09:42 . 更新依赖
package xstring
import (
"crypto/rand"
"fmt"
)
// 生成UUID
//
// 基于 `crypto/rand` 密钥库进行随机生成
func UUID() string {
b := make([]byte, 16)
_, err := rand.Read(b)
if err != nil {
return ""
}
return fmt.Sprintf("%x-%x-%x-%x-%x",
b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
}
Go
1
https://gitee.com/xiaoyutab/xgotool.git
git@gitee.com:xiaoyutab/xgotool.git
xiaoyutab
xgotool
xgotool
v0.3.9

搜索帮助

53164aa7 5694891 3bd8fe86 5694891