util: remove retry logic in shortid_generator
Use shortid.MustGenerate() instead of shortid.Generate(). Instead of returning errors it will panic.
This commit is contained in:
@@ -7,18 +7,9 @@ import (
|
||||
func init() {
|
||||
gen, _ := shortid.New(1, shortid.DefaultABC, 1)
|
||||
shortid.SetDefault(gen)
|
||||
|
||||
}
|
||||
|
||||
// GenerateShortUid generates a short unique identifier.
|
||||
func GenerateShortUid() (uid string, err error) {
|
||||
if uid, err = shortid.Generate(); err != nil {
|
||||
if uid, err = shortid.Generate(); err != nil {
|
||||
if uid, err = shortid.Generate(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return uid, nil
|
||||
func GenerateShortUid() string {
|
||||
return shortid.MustGenerate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user