diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 16:39:13 -0800 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 16:39:13 -0800 |
commit | d25ec27fb1c3df175e1b98af1fdc26881d68a1ab (patch) | |
tree | a79c729b92c0d0a52b19b37c3a506b988f1e0b80 /template/utils | |
download | whois-d25ec27fb1c3df175e1b98af1fdc26881d68a1ab.tar.gz whois-d25ec27fb1c3df175e1b98af1fdc26881d68a1ab.zip |
initial commit by simponic-infra
Diffstat (limited to 'template/utils')
-rw-r--r-- | template/utils/random_id.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/template/utils/random_id.go b/template/utils/random_id.go new file mode 100644 index 0000000..1b03ec8 --- /dev/null +++ b/template/utils/random_id.go @@ -0,0 +1,16 @@ +package utils + +import ( + "crypto/rand" + "fmt" +) + +func RandomId() string { + id := make([]byte, 16) + _, err := rand.Read(id) + if err != nil { + panic(err) + } + + return fmt.Sprintf("%x", id) +} |