From 87be7e4a8ad7cb76e673c5e5b9351b9139ba8421 Mon Sep 17 00:00:00 2001 From: Mikel Olasagasti Uranga Date: Mon, 15 Jan 2024 10:23:30 +0100 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, IMO Google's module is simpler, even if the `NewString` function can be bit confusing as doesn't reference UUID V4 in the name as satori's and other modules do. Signed-off-by: Mikel Olasagasti Uranga --- cmd/kube-burner/kube-burner.go | 8 ++++---- cmd/kube-burner/ocp.go | 4 ++-- go.mod | 3 +-- go.sum | 6 ++---- pkg/config/config.go | 4 ++-- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/cmd/kube-burner/kube-burner.go b/cmd/kube-burner/kube-burner.go index 67d21d068..968cb3083 100644 --- a/cmd/kube-burner/kube-burner.go +++ b/cmd/kube-burner/kube-burner.go @@ -36,7 +36,7 @@ import ( "github.com/cloud-bulldozer/go-commons/indexers" "github.com/kube-burner/kube-burner/pkg/prometheus" - uid "github.com/satori/go.uuid" + uid "github.com/google/uuid" "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" @@ -140,7 +140,7 @@ func initCmd() *cobra.Command { } }, } - cmd.Flags().StringVar(&uuid, "uuid", uid.NewV4().String(), "Benchmark UUID") + cmd.Flags().StringVar(&uuid, "uuid", uid.NewString(), "Benchmark UUID") cmd.Flags().StringVarP(&url, "prometheus-url", "u", "", "Prometheus URL") cmd.Flags().StringVarP(&token, "token", "t", "", "Prometheus Bearer token") cmd.Flags().StringVar(&username, "username", "", "Prometheus username for authentication") @@ -328,7 +328,7 @@ func indexCmd() *cobra.Command { } }, } - cmd.Flags().StringVar(&uuid, "uuid", uid.NewV4().String(), "Benchmark UUID") + cmd.Flags().StringVar(&uuid, "uuid", uid.NewString(), "Benchmark UUID") cmd.Flags().StringVarP(&url, "prometheus-url", "u", "", "Prometheus URL") cmd.Flags().StringVarP(&token, "token", "t", "", "Prometheus Bearer token") cmd.Flags().StringVar(&username, "username", "", "Prometheus username for authentication") @@ -447,7 +447,7 @@ func alertCmd() *cobra.Command { } }, } - cmd.Flags().StringVar(&uuid, "uuid", uid.NewV4().String(), "Benchmark UUID") + cmd.Flags().StringVar(&uuid, "uuid", uid.NewString(), "Benchmark UUID") cmd.Flags().StringVarP(&url, "prometheus-url", "u", "", "Prometheus URL") cmd.Flags().StringVarP(&token, "token", "t", "", "Prometheus Bearer token") cmd.Flags().StringVar(&username, "username", "", "Prometheus username for authentication") diff --git a/cmd/kube-burner/ocp.go b/cmd/kube-burner/ocp.go index 9b7044c67..1167d8ce2 100644 --- a/cmd/kube-burner/ocp.go +++ b/cmd/kube-burner/ocp.go @@ -21,8 +21,8 @@ import ( "time" "github.com/cloud-bulldozer/go-commons/indexers" + uid "github.com/google/uuid" "github.com/kube-burner/kube-burner/pkg/workloads" - uid "github.com/satori/go.uuid" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -43,7 +43,7 @@ func openShiftCmd() *cobra.Command { localIndexing := ocpCmd.PersistentFlags().Bool("local-indexing", false, "Enable local indexing") ocpCmd.PersistentFlags().StringVar(&workloadConfig.MetricsEndpoint, "metrics-endpoint", "", "YAML file with a list of metric endpoints") ocpCmd.PersistentFlags().BoolVar(&workloadConfig.Alerting, "alerting", true, "Enable alerting") - ocpCmd.PersistentFlags().StringVar(&workloadConfig.UUID, "uuid", uid.NewV4().String(), "Benchmark UUID") + ocpCmd.PersistentFlags().StringVar(&workloadConfig.UUID, "uuid", uid.NewString(), "Benchmark UUID") ocpCmd.PersistentFlags().DurationVar(&workloadConfig.Timeout, "timeout", 4*time.Hour, "Benchmark timeout") ocpCmd.PersistentFlags().IntVar(&workloadConfig.QPS, "qps", 20, "QPS") ocpCmd.PersistentFlags().IntVar(&workloadConfig.Burst, "burst", 20, "Burst") diff --git a/go.mod b/go.mod index f7d57e365..ec5bf43bb 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/Masterminds/sprig/v3 v3.2.2 github.com/cloud-bulldozer/go-commons v1.0.12 + github.com/google/uuid v1.5.0 github.com/montanaflynn/stats v0.7.1 github.com/openshift/client-go v0.0.0-20230718165156-6014fb98e86a github.com/prometheus/common v0.44.0 - github.com/satori/go.uuid v1.2.0 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.6.1 golang.org/x/time v0.1.0 @@ -37,7 +37,6 @@ require ( github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/huandu/xstrings v1.3.2 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/go.sum b/go.sum index f78208590..02746361b 100644 --- a/go.sum +++ b/go.sum @@ -264,8 +264,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 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/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= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.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.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= @@ -470,8 +470,6 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR 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/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= diff --git a/pkg/config/config.go b/pkg/config/config.go index 166767ccc..d8ac04168 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -28,7 +28,7 @@ import ( "github.com/kube-burner/kube-burner/pkg/util" log "github.com/sirupsen/logrus" - uid "github.com/satori/go.uuid" + uid "github.com/google/uuid" "gopkg.in/yaml.v3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/validation" @@ -41,7 +41,7 @@ import ( var configSpec = Spec{ GlobalConfig: GlobalConfig{ - RUNID: uid.NewV4().String(), + RUNID: uid.NewString(), GC: false, GCMetrics: false, GCTimeout: 1 * time.Hour,