Skip to content

Commit

Permalink
Use google/uuid
Browse files Browse the repository at this point in the history
This fixes the double generation as well as simplifies the code and
vendored dependencies.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed Jul 18, 2023
1 parent b8bf840 commit 84686c7
Show file tree
Hide file tree
Showing 20 changed files with 3 additions and 744 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ require (
github.com/docker/go-units v0.5.0
github.com/golang/glog v1.1.1
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.0
github.com/moby/term v0.5.0
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.8
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/runc v1.1.7
github.com/opencontainers/selinux v1.11.0
github.com/pborman/uuid v1.2.1
github.com/sirupsen/logrus v1.9.3
github.com/urfave/cli/v2 v2.25.7
golang.org/x/net v0.12.0
Expand Down Expand Up @@ -55,7 +55,6 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down Expand Up @@ -233,8 +232,6 @@ github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/
github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50=
github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU=
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw=
github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
22 changes: 2 additions & 20 deletions pkg/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import (
"os"
"runtime"
"strings"
"sync"
"time"

"github.com/docker/distribution/reference"
"github.com/pborman/uuid"
"github.com/google/uuid"
"gopkg.in/yaml.v3"
internalapi "k8s.io/cri-api/pkg/apis"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
Expand All @@ -37,12 +36,6 @@ import (
)

var (
//lock for uuid
uuidLock sync.Mutex

// lastUUID record last generated uuid from NewUUID()
lastUUID uuid.UUID

// the callbacks to run during BeforeSuite
beforeSuiteCallbacks []func()

Expand Down Expand Up @@ -191,18 +184,7 @@ func ExpectNoError(err error, explain ...interface{}) {

// NewUUID creates a new UUID string.
func NewUUID() string {
uuidLock.Lock()
defer uuidLock.Unlock()
result := uuid.NewUUID()
// The UUID package is naive and can generate identical UUIDs if the
// time interval is quick enough.
// The UUID uses 100 ns increments so it's short enough to actively
// wait for a new value.
for uuid.Equal(lastUUID, result) == true {
result = uuid.NewUUID()
}
lastUUID = result
return result.String()
return uuid.New().String()
}

// RunDefaultPodSandbox runs a PodSandbox with default options.
Expand Down
10 changes: 0 additions & 10 deletions vendor/github.com/pborman/uuid/.travis.yml

This file was deleted.

10 changes: 0 additions & 10 deletions vendor/github.com/pborman/uuid/CONTRIBUTING.md

This file was deleted.

1 change: 0 additions & 1 deletion vendor/github.com/pborman/uuid/CONTRIBUTORS

This file was deleted.

27 changes: 0 additions & 27 deletions vendor/github.com/pborman/uuid/LICENSE

This file was deleted.

15 changes: 0 additions & 15 deletions vendor/github.com/pborman/uuid/README.md

This file was deleted.

84 changes: 0 additions & 84 deletions vendor/github.com/pborman/uuid/dce.go

This file was deleted.

13 changes: 0 additions & 13 deletions vendor/github.com/pborman/uuid/doc.go

This file was deleted.

53 changes: 0 additions & 53 deletions vendor/github.com/pborman/uuid/hash.go

This file was deleted.

85 changes: 0 additions & 85 deletions vendor/github.com/pborman/uuid/marshal.go

This file was deleted.

Loading

0 comments on commit 84686c7

Please sign in to comment.