remove uses of pkg/stringid.GenerateRandomID()
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>
This commit is contained in:
15
internal/test/randomid.go
Normal file
15
internal/test/randomid.go
Normal file
@ -0,0 +1,15 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user