From e49ac20cc6d551be78f2027c435cb5f1be78aedf Mon Sep 17 00:00:00 2001 From: Matjaz Domen Pecan Date: Thu, 4 Jan 2018 11:09:37 +0100 Subject: [PATCH] Adjust randomize.go so it works with the new version of satori/go.uuid --- randomize/randomize.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/randomize/randomize.go b/randomize/randomize.go index 81b0b3b33..22b96d2cc 100644 --- a/randomize/randomize.go +++ b/randomize/randomize.go @@ -195,7 +195,11 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo return nil } if fieldType == "uuid" { - value = null.NewString(uuid.NewV4().String(), true) + randomUuid, err := uuid.NewV4() + if err != nil { + return err + } + value = null.NewString(randomUuid.String(), true) field.Set(reflect.ValueOf(value)) return nil } @@ -268,7 +272,10 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo return nil } if fieldType == "uuid" { - value = uuid.NewV4().String() + value, err := uuid.NewV4() + if err != nil { + return err + } field.Set(reflect.ValueOf(value)) return nil } @@ -390,7 +397,11 @@ func getArrayRandValue(s *Seed, typ reflect.Type, fieldType string) interface{} return types.StringArray{value, value} } if fieldType == "uuid" { - value := uuid.NewV4().String() + randomUuid, err := uuid.NewV4() + if err != nil { + return err + } + value := randomUuid.String() return types.StringArray{value, value} } if fieldType == "box" || fieldType == "line" || fieldType == "lseg" ||