本文介绍一个go 生成UUID的包
UUID package for Go language
This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs.
Installation
go get github.com/satori/go.uuid
Requirements
UUID package tested against Go >= 1.6.
Example
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