moby/utils/random.go
Levi Gross a7b60b21de Fixed up if statement
Signed-off-by: Levi Gross <levi@levigross.com>

Docker-DCO-1.1-Signed-off-by: Levi Gross <levi@levigross.com> (github: levigross)
2014-06-10 10:02:00 -04:00

16 lines
249 B
Go

package utils
import (
"crypto/rand"
"encoding/hex"
"io"
)
func RandomString() string {
id := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, id); err != nil {
panic(err) // This shouldn't happen
}
return hex.EncodeToString(id)
}