mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
Rename getUUID() into mustGetUUID() (#3320)
In case of UUID generation failure mustGetUUID() will panic than infinitely trying in for loop.
This commit is contained in:
+7
-11
@@ -127,18 +127,14 @@ func pathJoin(elem ...string) string {
|
||||
return path.Join(elem...) + trailingSlash
|
||||
}
|
||||
|
||||
// getUUID() - get a unique uuid.
|
||||
func getUUID() (uuidStr string) {
|
||||
for {
|
||||
uuid, err := uuid.New()
|
||||
if err != nil {
|
||||
errorIf(err, "Unable to initialize uuid")
|
||||
continue
|
||||
}
|
||||
uuidStr = uuid.String()
|
||||
break
|
||||
// mustGetUUID - get a random UUID.
|
||||
func mustGetUUID() string {
|
||||
uuid, err := uuid.New()
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Random UUID generation failed. Error: %s", err))
|
||||
}
|
||||
return uuidStr
|
||||
|
||||
return uuid.String()
|
||||
}
|
||||
|
||||
// Create an s3 compatible MD5sum for complete multipart transaction.
|
||||
|
||||
Reference in New Issue
Block a user