diff --git a/common.go b/common.go index 323cc2b..896bdb3 100644 --- a/common.go +++ b/common.go @@ -8,6 +8,7 @@ import ( "crypto/rand" "encoding/binary" "encoding/hex" + "fmt" "os" "reflect" "runtime" @@ -31,13 +32,10 @@ func UUID() string { // Setup seed & counter once uuidSetup.Do(func() { if _, err := rand.Read(uuidSeed[:]); err != nil { - return + panic(fmt.Errorf("utils: failed to seed UUID generator: %w", err)) } uuidCounter = binary.LittleEndian.Uint64(uuidSeed[:8]) }) - if atomic.LoadUint64(&uuidCounter) <= 0 { - return "00000000-0000-0000-0000-000000000000" - } // first 8 bytes differ, taking a slice of the first 16 bytes x := atomic.AddUint64(&uuidCounter, 1) uuid := uuidSeed