diff --git a/go.mod b/go.mod index 98b579b5b..4d981d006 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,7 @@ module github.com/project-koku/koku-metrics-operator go 1.22 +toolchain go1.22.5 require ( github.com/go-logr/logr v1.4.2 diff --git a/internal/controller/kokumetricsconfig_controller.go b/internal/controller/kokumetricsconfig_controller.go index 281369e19..0a81b7422 100644 --- a/internal/controller/kokumetricsconfig_controller.go +++ b/internal/controller/kokumetricsconfig_controller.go @@ -297,7 +297,7 @@ func GetAuthSecret(r *MetricsConfigReconciler, cr *metricscfgv1beta1.MetricsConf if len(keys[k]) <= 0 { msg := fmt.Sprintf("secret not found with expected %s data", k) log.Info(msg) - return fmt.Errorf(msg) + return fmt.Errorf("%s", msg) } } @@ -339,7 +339,7 @@ func (r *MetricsConfigReconciler) GetServiceAccountSecret(ctx context.Context, c if len(keys[requiredKey]) <= 0 { msg := fmt.Sprintf("service account secret not found with expected %s data", requiredKey) log.Info(msg) - return fmt.Errorf(msg) + return fmt.Errorf("%s", msg) } } log.Info("found required keys in secret") @@ -935,7 +935,8 @@ func concatErrs(errors ...error) error { errstrings = append(errstrings, e.Error()) } if len(errstrings) > 0 { - err = fmt.Errorf(strings.Join(errstrings, "\n")) + msg := strings.Join(errstrings, "\n") + err = fmt.Errorf("%s", msg) } return err } diff --git a/internal/sources/handler.go b/internal/sources/handler.go index e0e7e7599..6bc55760d 100644 --- a/internal/sources/handler.go +++ b/internal/sources/handler.go @@ -386,7 +386,7 @@ func SourceGetOrCreate(handler *SourceHandler, client crhchttp.HTTPClient) (bool log.Info("create source = " + strconv.FormatBool(*handler.Spec.CreateSource)) msg := fmt.Sprintf("No OpenShift source registered with name %s and Cluster ID %s.", handler.Spec.SourceName, handler.Auth.ClusterID) if !*handler.Spec.CreateSource { - return false, metav1.Now(), fmt.Errorf(msg) + return false, metav1.Now(), fmt.Errorf("%s", msg) } log.Info(msg) @@ -398,7 +398,7 @@ func SourceGetOrCreate(handler *SourceHandler, client crhchttp.HTTPClient) (bool if source != nil { errMsg := fmt.Sprintf("This cluster may already be registered because an OpenShift source with Cluster ID %s is already registered with a different name (%s).", handler.Auth.ClusterID, source.Name) log.Info(errMsg) - return false, metav1.Now(), fmt.Errorf(errMsg) + return false, metav1.Now(), fmt.Errorf("%s", errMsg) } // Check if source name is already in use @@ -416,7 +416,7 @@ func SourceGetOrCreate(handler *SourceHandler, client crhchttp.HTTPClient) (bool handler.Spec.SourceName, source.SourceRef) } log.Info(errMsg) - return false, metav1.Now(), fmt.Errorf(errMsg) + return false, metav1.Now(), fmt.Errorf("%s", errMsg) } // No source is registered with this name