-
Notifications
You must be signed in to change notification settings - Fork 0
/
must.go
36 lines (33 loc) · 893 Bytes
/
must.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package fastuuid
// MustUUIDv4 generate uuid without allocations
// It will panic if it can't read random data.
//
// It is safe calling this function from concurrent goroutines.
func MustUUIDv4() [16]byte {
res, err := UUIDv4()
if err != nil {
panic(err)
}
return res
}
// MustUUIDv4String generate uuid random string with only one allocation
// It will panic if it can't read random data.
//
// It is safe calling this function from concurrent goroutines.
func MustUUIDv4String() string {
res, err := UUIDv4String()
if err != nil {
panic(err)
}
return res
}
// MustUUIDv4StringBytes generate uuid and render it as string to dst buffer without allocations
// It will panic if it can't read random data.
//
// It is safe calling this function from concurrent goroutines.
func MustUUIDv4StringBytes(dst []byte) {
err := UUIDv4StringBytes(dst)
if err != nil {
panic(err)
}
}