赞
踩
本文介绍一个go 生成UUID的包
This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs.
go get github.com/satori/go.uuid
UUID package tested against Go >= 1.6.
- import (
- "fmt"
- "testing"
-
- "github.com/satori/go.uuid"
- )
-
- func TestUUIDBuild(t *testing.T) {
- u,err:=uuid.NewV4()
- if err!=nil {
- fmt.Println(err)
- }else{
- fmt.Println(u)
- }
- }
- ----------------------------------------
- 10b583d2-2ecc-4854-8a3d-270dbe6b5665
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。