From dd822e13f54610a81e658f6001ff78910afe0fc7 Mon Sep 17 00:00:00 2001 From: Mikel Olasagasti Uranga Date: Fri, 19 Apr 2024 23:00:17 +0200 Subject: [PATCH] Switch to Google's uuid module `satori/uuid` repo is dead and has different problems as shown in https://github.com/satori/go.uuid/issues/84 Although a fork exists to continue `satori/uuid`, Google's module is simpler and already used as indirect dependency. Signed-off-by: Mikel Olasagasti Uranga --- go.mod | 3 +-- go.sum | 5 ++--- pkg/cmd/add_space_users_test.go | 6 +++--- pkg/cmd/generate/admin-manifests_test.go | 4 ++-- pkg/test/usersignup.go | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 99052a4..1fae4b0 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/openshift/api v0.0.0-20230213134911-7ba313770556 github.com/operator-framework/api v0.13.0 github.com/pkg/errors v0.9.1 - github.com/satori/go.uuid v1.2.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 golang.org/x/term v0.15.0 @@ -29,6 +28,7 @@ require ( require ( github.com/charmbracelet/log v0.4.0 + github.com/google/uuid v1.6.0 github.com/h2non/gock v1.2.0 ) @@ -74,7 +74,6 @@ require ( github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/google/uuid v1.1.2 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect diff --git a/go.sum b/go.sum index 6725f3a..5b0068c 100644 --- a/go.sum +++ b/go.sum @@ -342,8 +342,9 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaU github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= @@ -606,8 +607,6 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/scylladb/go-set v1.0.2/go.mod h1:DkpGd78rljTxKAnTDPFqXSGxvETQnJyuSOQwsHycqfs= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= diff --git a/pkg/cmd/add_space_users_test.go b/pkg/cmd/add_space_users_test.go index 5d0bb68..b1fb021 100644 --- a/pkg/cmd/add_space_users_test.go +++ b/pkg/cmd/add_space_users_test.go @@ -12,7 +12,7 @@ import ( clicontext "github.com/kubesaw/ksctl/pkg/context" . "github.com/kubesaw/ksctl/pkg/test" - uuid "github.com/satori/go.uuid" + uuid "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/runtime" @@ -204,10 +204,10 @@ func initAddSpaceUsersTest(t *testing.T, murs ...*toolchainv1alpha1.MasterUserRe nsTemplateTier := newNSTemplateTier("base") roles := make(map[string]toolchainv1alpha1.NSTemplateTierSpaceRole) roles["admin"] = toolchainv1alpha1.NSTemplateTierSpaceRole{ - TemplateRef: uuid.NewV4().String(), + TemplateRef: uuid.NewString(), } roles["viewer"] = toolchainv1alpha1.NSTemplateTierSpaceRole{ - TemplateRef: uuid.NewV4().String(), + TemplateRef: uuid.NewString(), } nsTemplateTier.Spec.SpaceRoles = roles objs := []runtime.Object{space, nsTemplateTier} diff --git a/pkg/cmd/generate/admin-manifests_test.go b/pkg/cmd/generate/admin-manifests_test.go index 4c2bdc9..f8e21cc 100644 --- a/pkg/cmd/generate/admin-manifests_test.go +++ b/pkg/cmd/generate/admin-manifests_test.go @@ -7,11 +7,11 @@ import ( "testing" commontest "github.com/codeready-toolchain/toolchain-common/pkg/test" + uuid "github.com/google/uuid" "github.com/kubesaw/ksctl/pkg/client" "github.com/kubesaw/ksctl/pkg/configuration" . "github.com/kubesaw/ksctl/pkg/test" userv1 "github.com/openshift/api/user/v1" - uuid "github.com/satori/go.uuid" "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" @@ -131,7 +131,7 @@ func TestSetup(t *testing.T) { t.Run("if out dir doesn't exist then it creates", func(t *testing.T) { // given - outTempDir := filepath.Join(os.TempDir(), fmt.Sprintf("setup-cli-test-%s", uuid.NewV4().String())) + outTempDir := filepath.Join(os.TempDir(), fmt.Sprintf("setup-cli-test-%s", uuid.NewString())) term := NewFakeTerminalWithResponse("Y") term.Tee(os.Stdout) flags := newSetupFlags(outDir(outTempDir), kubeSawAdminsFile(configFile)) diff --git a/pkg/test/usersignup.go b/pkg/test/usersignup.go index a629366..1b47f58 100644 --- a/pkg/test/usersignup.go +++ b/pkg/test/usersignup.go @@ -8,7 +8,7 @@ import ( "github.com/codeready-toolchain/toolchain-common/pkg/states" "github.com/codeready-toolchain/toolchain-common/pkg/test" - uuid "github.com/satori/go.uuid" + uuid "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" @@ -19,7 +19,7 @@ import ( func NewUserSignup(modifiers ...UserSignupModifier) *toolchainv1alpha1.UserSignup { signup := &toolchainv1alpha1.UserSignup{ ObjectMeta: metav1.ObjectMeta{ - Name: uuid.NewV4().String(), + Name: uuid.NewString(), Namespace: test.HostOperatorNs, Labels: map[string]string{ toolchainv1alpha1.UserSignupUserEmailHashLabelKey: "fd2addbd8d82f0d2dc088fa122377eaa",