This utility was only used for testing, and to generate a random suffix for Dockerfiles. As we don't need the same contract as pkg/stringid.GenerateRandomID() (not allow all-numeric IDs as they would not be usable for hostnames), we can use a local test-utility, and local implementation for the random suffix instead. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
16 lines
289 B
Go
16 lines
289 B
Go
package test
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
)
|
|
|
|
// RandomID returns a unique, 64-character ID consisting of a-z, 0-9.
|
|
func RandomID() string {
|
|
b := make([]byte, 32)
|
|
if _, err := rand.Read(b); err != nil {
|
|
panic(err) // This shouldn't happen
|
|
}
|
|
return hex.EncodeToString(b)
|
|
}
|