赞
踩
- package main
-
- import (
- "fmt"
- "github.com/satori/go.uuid"
- )
-
- func main() {
- //开源工具包生成uuid
- createUUIDByOpenUtils()
- }
-
- func createUUIDByOpenUtils() {
- // Creating UUID Version 4
- u1 := uuid.NewV4().String()
- fmt.Println(u1)
- // Parsing UUID from string input
- u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
- if err != nil {
- fmt.Printf("Something went wrong: %s", err)
- }
- fmt.Printf("Successfully parsed: %s", u2)
- }
生成结果如图:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。