From c615442ad6313ed09144d16daa9ca5781edad5f1 Mon Sep 17 00:00:00 2001 From: "lukasz.widera@vshn.ch" Date: Wed, 2 Oct 2024 12:36:47 +0200 Subject: [PATCH] refactoring for loop --- pkg/cloudscale/objectstorage.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/cloudscale/objectstorage.go b/pkg/cloudscale/objectstorage.go index 6d5c536..5da11cd 100644 --- a/pkg/cloudscale/objectstorage.go +++ b/pkg/cloudscale/objectstorage.go @@ -114,17 +114,15 @@ func (o *ObjectStorage) GetMetrics(ctx context.Context, billingDate time.Time) ( return nil, err } - for bucket := range bucketMap { - bucketName := bucketMap[bucket].BucketMetricsData.Subject.BucketName - if val, ok := buckets[bucketName]; ok { - bucketMap[bucket].Zone = val.Zone + for name, bucket := range bucketMap { + if val, ok := buckets[name]; ok { + bucket.Zone = val.Zone } // assign organisation to bucketMap - if val, ok := nsTenants[bucketMap[bucket].Namespace]; ok { - bucketMap[bucket].Organization = val + if val, ok := nsTenants[bucket.Namespace]; ok { + bucket.Organization = val } - } allRecords := make([]odoo.OdooMeteredBillingRecord, 0)