Просмотр исходного кода

Properly initialize my variables

Signed-off-by: Matt Ray <github@mattray.dev>
Matt Ray 2 лет назад
Родитель
Сommit
7166ad1069
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      pkg/cmd/costmodel/costmodel.go

+ 4 - 3
pkg/cmd/costmodel/costmodel.go

@@ -36,15 +36,16 @@ func Execute(opts *CostModelOpts) error {
 	log.Infof("Starting cost-model version %s", version.FriendlyVersion())
 	log.Infof("Kubernetes enabled: %t", env.IsKubernetesEnabled())
 
-	a := costmodel.InitializeWithoutKubernetes()
+	var a *costmodel.Accesses
 
 	if env.IsKubernetesEnabled() {
-		a := costmodel.Initialize()
-
+		a = costmodel.Initialize()
 		err := StartExportWorker(context.Background(), a.Model)
 		if err != nil {
 			log.Errorf("couldn't start CSV export worker: %v", err)
 		}
+	} else {
+		a = costmodel.InitializeWithoutKubernetes()
 	}
 
 	log.Infof("Cloud Costs enabled: %t", env.IsCloudCostEnabled())