From 74c359920eabcde7baa9e1771cf787a37eed9114 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Feb 2021 15:58:09 +0000 Subject: [PATCH] Bump github.com/hashicorp/go-uuid from 1.0.1 to 1.0.2 Bumps [github.com/hashicorp/go-uuid](https://github.com/hashicorp/go-uuid) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/hashicorp/go-uuid/releases) - [Commits](https://github.com/hashicorp/go-uuid/compare/v1.0.1...v1.0.2) Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 2 ++ vendor/github.com/hashicorp/go-uuid/uuid.go | 22 +++++++++++++++++++-- vendor/modules.txt | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 8c9ce204..5eae2c6a 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/dustinkirkland/golang-petname v0.0.0-20170105215008-242afa0b4f8a github.com/hashicorp/errwrap v1.1.0 - github.com/hashicorp/go-uuid v1.0.1 + github.com/hashicorp/go-uuid v1.0.2 github.com/hashicorp/terraform-plugin-docs v0.4.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3 ) diff --git a/go.sum b/go.sum index f03550ea..7cf84b35 100644 --- a/go.sum +++ b/go.sum @@ -200,6 +200,8 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= diff --git a/vendor/github.com/hashicorp/go-uuid/uuid.go b/vendor/github.com/hashicorp/go-uuid/uuid.go index 911227f6..0c10c4e9 100644 --- a/vendor/github.com/hashicorp/go-uuid/uuid.go +++ b/vendor/github.com/hashicorp/go-uuid/uuid.go @@ -4,22 +4,40 @@ import ( "crypto/rand" "encoding/hex" "fmt" + "io" ) // GenerateRandomBytes is used to generate random bytes of given size. func GenerateRandomBytes(size int) ([]byte, error) { + return GenerateRandomBytesWithReader(size, rand.Reader) +} + +// GenerateRandomBytesWithReader is used to generate random bytes of given size read from a given reader. +func GenerateRandomBytesWithReader(size int, reader io.Reader) ([]byte, error) { + if reader == nil { + return nil, fmt.Errorf("provided reader is nil") + } buf := make([]byte, size) - if _, err := rand.Read(buf); err != nil { + if _, err := io.ReadFull(reader, buf); err != nil { return nil, fmt.Errorf("failed to read random bytes: %v", err) } return buf, nil } + const uuidLen = 16 // GenerateUUID is used to generate a random UUID func GenerateUUID() (string, error) { - buf, err := GenerateRandomBytes(uuidLen) + return GenerateUUIDWithReader(rand.Reader) +} + +// GenerateUUIDWithReader is used to generate a random UUID with a given Reader +func GenerateUUIDWithReader(reader io.Reader) (string, error) { + if reader == nil { + return "", fmt.Errorf("provided reader is nil") + } + buf, err := GenerateRandomBytesWithReader(uuidLen, reader) if err != nil { return "", err } diff --git a/vendor/modules.txt b/vendor/modules.txt index cc423e6b..421cfe94 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -119,7 +119,7 @@ github.com/hashicorp/go-plugin github.com/hashicorp/go-plugin/internal/plugin # github.com/hashicorp/go-safetemp v1.0.0 github.com/hashicorp/go-safetemp -# github.com/hashicorp/go-uuid v1.0.1 +# github.com/hashicorp/go-uuid v1.0.2 ## explicit github.com/hashicorp/go-uuid # github.com/hashicorp/go-version v1.2.1