mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-05 13:52:26 +00:00
Refactor error handling and utility functions; remove deprecated code and improve logging
This commit is contained in:
18
core/utils/uuid.go
Normal file
18
core/utils/uuid.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
|
||||
"github.com/akyaiy/GoSally-mvp/core/config"
|
||||
)
|
||||
|
||||
func NewUUID() (string, error) {
|
||||
bytes := make([]byte, int(config.GetInternalConsts().GetUUIDLength()/2))
|
||||
_, err := rand.Read(bytes)
|
||||
if err != nil {
|
||||
return "", errors.New("failed to generate UUID: " + err.Error())
|
||||
}
|
||||
return hex.EncodeToString(bytes), nil
|
||||
}
|
||||
Reference in New Issue
Block a user