mirror of
https://github.com/docker/cli.git
synced 2026-01-15 07:40:57 +03:00
17 lines
248 B
Go
17 lines
248 B
Go
package utils
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
"io"
|
|
)
|
|
|
|
func RandomString() string {
|
|
id := make([]byte, 32)
|
|
_, err := io.ReadFull(rand.Reader, id)
|
|
if err != nil {
|
|
panic(err) // This shouldn't happen
|
|
}
|
|
return hex.EncodeToString(id)
|
|
}
|