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:
Marcus Efraimsson
2018-01-30 23:18:34 +01:00
parent 9fb7b887db
commit 4829ea0e9f
2 changed files with 4 additions and 13 deletions
+2 -11
View File
@@ -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()
}