aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/go-uuid/uuid.go
diff options
context:
space:
mode:
authorAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
committerAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
commit15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch)
tree255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/hashicorp/go-uuid/uuid.go
parent07971ca38143c5faf951d152fba370ddcbe26ad5 (diff)
downloadterraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz
terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst
terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/github.com/hashicorp/go-uuid/uuid.go')
-rw-r--r--vendor/github.com/hashicorp/go-uuid/uuid.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/vendor/github.com/hashicorp/go-uuid/uuid.go b/vendor/github.com/hashicorp/go-uuid/uuid.go
index 322b522..ff9364c 100644
--- a/vendor/github.com/hashicorp/go-uuid/uuid.go
+++ b/vendor/github.com/hashicorp/go-uuid/uuid.go
@@ -6,13 +6,21 @@ import (
6 "fmt" 6 "fmt"
7) 7)
8 8
9// GenerateUUID is used to generate a random UUID 9// GenerateRandomBytes is used to generate random bytes of given size.
10func GenerateUUID() (string, error) { 10func GenerateRandomBytes(size int) ([]byte, error) {
11 buf := make([]byte, 16) 11 buf := make([]byte, size)
12 if _, err := rand.Read(buf); err != nil { 12 if _, err := rand.Read(buf); err != nil {
13 return "", fmt.Errorf("failed to read random bytes: %v", err) 13 return nil, fmt.Errorf("failed to read random bytes: %v", err)
14 } 14 }
15 return buf, nil
16}
15 17
18// GenerateUUID is used to generate a random UUID
19func GenerateUUID() (string, error) {
20 buf, err := GenerateRandomBytes(16)
21 if err != nil {
22 return "", err
23 }
16 return FormatUUID(buf) 24 return FormatUUID(buf)
17} 25}
18 26