diff --git a/service/repositories/resource.go b/service/repositories/resource.go index d6eb0aca..5384ad66 100644 --- a/service/repositories/resource.go +++ b/service/repositories/resource.go @@ -61,7 +61,7 @@ func (d *defaultResource) UpdateMetadata(ctx context.Context, in *UpdateMetadata return err } var newResourceMetadata string - if oldResource.Metadata != nil && *oldResource.Metadata != "{}" { + if oldResource.Metadata != nil && *oldResource.Metadata != "{}" && *oldResource.Metadata != "" { var oldResourceMetadata map[string]interface{} err = json.Unmarshal([]byte(*oldResource.Metadata), &oldResourceMetadata) if err != nil { @@ -72,8 +72,8 @@ func (d *defaultResource) UpdateMetadata(ctx context.Context, in *UpdateMetadata switch val := v.(type) { case map[string]interface{}: oldResourceMetadataData := oldResourceMetadata[k].(map[string]interface{}) - for key := range val { - oldResourceMetadataData[key] = val + for key, val1 := range val { + oldResourceMetadataData[key] = val1 } oldResourceMetadata[k] = oldResourceMetadataData } @@ -90,8 +90,8 @@ func (d *defaultResource) UpdateMetadata(ctx context.Context, in *UpdateMetadata switch val := v.(type) { case map[string]interface{}: var resourceMetadataData = make(map[string]interface{}, len(val)) - for key := range val { - resourceMetadataData[key] = val + for key, val1 := range val { + resourceMetadataData[key] = val1 } resourceMetadata[k] = resourceMetadataData }