Update Uid() func to v4 Unique id.
Reduce Collisions and Standard RFC 4122
This commit is contained in:
parent
a51f5994bb
commit
d2eb7e664a
|
@ -19,5 +19,11 @@ func Uid() string {
|
|||
// for random bits.
|
||||
panic(err)
|
||||
}
|
||||
// UUID version 4
|
||||
id[6] = (id[6] & 0x0f) | (4<<4)
|
||||
|
||||
// SetVariant sets variant bits as described in RFC 4122.
|
||||
id[8] = (id[8] & 0xbf | 0x80)
|
||||
|
||||
return hex.EncodeToString(id)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue