From 25c0a10b18ba0cdd72867168a5e5eca8f22d9b96 Mon Sep 17 00:00:00 2001 From: Dan Rammer Date: Mon, 20 Mar 2023 12:21:36 -0500 Subject: [PATCH] replaced github.com/satori/go.uuid with github.com/gofrs/uuid (#101) Signed-off-by: Daniel Rammer --- go.mod | 3 +-- go.sum | 1 - pkg/repositories/models/dataset.go | 8 ++++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 237b7482..3e6a2949 100644 --- a/go.mod +++ b/go.mod @@ -6,11 +6,11 @@ require ( github.com/Selvatico/go-mocket v1.0.7 github.com/flyteorg/flyteidl v1.3.6 github.com/flyteorg/flytestdlib v1.0.15 + github.com/gofrs/uuid v4.2.0+incompatible github.com/golang/glog v1.0.0 github.com/golang/protobuf v1.5.2 github.com/jackc/pgconn v1.10.1 github.com/mitchellh/mapstructure v1.4.3 - github.com/satori/go.uuid v1.2.0 github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.7.1 @@ -46,7 +46,6 @@ require ( github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-logr/logr v0.4.0 // indirect - github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/golang-jwt/jwt/v4 v4.4.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.5.8 // indirect diff --git a/go.sum b/go.sum index 4e7bebc3..cde10c1b 100644 --- a/go.sum +++ b/go.sum @@ -485,7 +485,6 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= diff --git a/pkg/repositories/models/dataset.go b/pkg/repositories/models/dataset.go index 1afb814e..93dcd967 100644 --- a/pkg/repositories/models/dataset.go +++ b/pkg/repositories/models/dataset.go @@ -1,7 +1,7 @@ package models import ( - uuid "github.com/satori/go.uuid" + "github.com/gofrs/uuid" "gorm.io/gorm" ) @@ -29,7 +29,11 @@ type PartitionKey struct { // BeforeCreate so that we set the UUID in golang rather than from a DB function call func (dataset *Dataset) BeforeCreate(tx *gorm.DB) error { if dataset.UUID == "" { - generated := uuid.NewV4() + generated, err := uuid.NewV4() + if err != nil { + return err + } + tx.Model(dataset).Update("UUID", generated) } return nil