Blame view
guid.go
276 Bytes
1c83dc241 GUID and timer |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
package webutility import ( "crypto/rand" "fmt" ) // GUID ... func GUID() (string, error) { b := make([]byte, 16) _, err := rand.Read(b) if err != nil { return "", err } id := fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]) return id, nil } |