diff --git a/google/services/compute/metadata.go b/google/services/compute/metadata.go index a7671155756..3b82efda849 100644 --- a/google/services/compute/metadata.go +++ b/google/services/compute/metadata.go @@ -86,7 +86,7 @@ func BetaMetadataUpdate(oldMDMap map[string]interface{}, newMDMap map[string]int } func expandComputeMetadata(m map[string]interface{}) []*compute.MetadataItems { - metadata := make([]*compute.MetadataItems, len(m)) + metadata := make([]*compute.MetadataItems, 0, len(m)) var keys []string for key := range m { keys = append(keys, key) diff --git a/google/services/compute/resource_compute_subnetwork.go b/google/services/compute/resource_compute_subnetwork.go index 71f30340b0c..1701be01943 100644 --- a/google/services/compute/resource_compute_subnetwork.go +++ b/google/services/compute/resource_compute_subnetwork.go @@ -345,8 +345,8 @@ func resourceComputeSubnetworkSecondaryIpRangeSetStyleDiff(_ context.Context, di if count < 1 { return nil } - old := make([]interface{}, count) - new := make([]interface{}, count) + old := make([]interface{}, 0, count) + new := make([]interface{}, 0, count) for i := 0; i < count; i++ { o, n := diff.GetChange(fmt.Sprintf("secondary_ip_range.%d", i))