GitOps for k8s
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

guid.go 243B

1234567891011121314151617
  1. package guid
  2. import (
  3. "fmt"
  4. "math/rand"
  5. "time"
  6. )
  7. func init() {
  8. rand.Seed(time.Now().UnixNano())
  9. }
  10. func New() string {
  11. b := make([]byte, 16)
  12. rand.Read(b)
  13. return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
  14. }