Skip to content

Commit

Permalink
refactor: resolve downstream gosimple warnings (#12539) (#20667)
Browse files Browse the repository at this point in the history
[upstream:ea2e527d54d8e3558ccae91cf8b28684e3c47330]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Dec 11, 2024
1 parent 79a803d commit 59c7f9b
Show file tree
Hide file tree
Showing 25 changed files with 52 additions and 54 deletions.
3 changes: 3 additions & 0 deletions .changelog/12539.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
6 changes: 3 additions & 3 deletions google/provider/universe/universe_domain_compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestAccUniverseDomainDisk(t *testing.T) {
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeDiskDestroyProducer(t),
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccUniverseDomain_basic_disk(universeDomain),
},
},
Expand All @@ -43,7 +43,7 @@ func TestAccDefaultUniverseDomainDisk(t *testing.T) {
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeDiskDestroyProducer(t),
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccUniverseDomain_basic_disk(universeDomain),
},
},
Expand All @@ -57,7 +57,7 @@ func TestAccDefaultUniverseDomain_doesNotMatchExplicit(t *testing.T) {
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccUniverseDomain_basic_disk(universeDomainFake),
ExpectError: regexp.MustCompile("Universe domain mismatch"),
},
Expand Down
2 changes: 1 addition & 1 deletion google/provider/universe/universe_domain_pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestAccUniverseDomainPubSub(t *testing.T) {
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t),
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccUniverseDomain_basic_pubsub(universeDomain, topic, subscription),
},
},
Expand Down
2 changes: 1 addition & 1 deletion google/provider/universe/universe_domain_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestAccUniverseDomainStorage(t *testing.T) {
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccStorageBucketDestroyProducer(t),
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccUniverseDomain_bucket(universeDomain, bucketName),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ func flattenAssuredWorkloadsWorkloadLabels(v map[string]string, d *schema.Resour

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -970,7 +970,7 @@ func flattenAssuredWorkloadsWorkloadTerraformLabels(v map[string]string, d *sche

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) {
"empty subset view": {
sv: bigtable.SubsetViewInfo{},
want: []map[string]interface{}{
map[string]interface{}{},
{},
},
orWant: nil,
},
Expand All @@ -29,7 +29,7 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) {
RowPrefixes: [][]byte{[]byte("row1"), []byte("row2")},
},
want: []map[string]interface{}{
map[string]interface{}{
{
"row_prefixes": []string{"cm93MQ==", "cm93Mg=="},
},
},
Expand All @@ -47,26 +47,26 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) {
},
},
want: []map[string]interface{}{
map[string]interface{}{
{
"family_subsets": []map[string]interface{}{
map[string]interface{}{
{
"family_name": "fam1",
"qualifier_prefixes": []string{"Y29s"},
}, map[string]interface{}{
}, {
"family_name": "fam2",
"qualifiers": []string{"Y29sMQ==", "Y29sMg=="},
},
},
},
},
orWant: []map[string]interface{}{
map[string]interface{}{
{
"family_subsets": []map[string]interface{}{
map[string]interface{}{
{
"family_name": "fam2",
"qualifiers": []string{"Y29sMQ==", "Y29sMg=="},
},
map[string]interface{}{
{
"family_name": "fam1",
"qualifier_prefixes": []string{"Y29s"},
},
Expand All @@ -83,9 +83,9 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) {
},
},
want: []map[string]interface{}{
map[string]interface{}{
{
"family_subsets": []map[string]interface{}{
map[string]interface{}{
{
"family_name": "fam",
"qualifiers": []string{"Y29s"},
},
Expand All @@ -103,9 +103,9 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) {
},
},
want: []map[string]interface{}{
map[string]interface{}{
{
"family_subsets": []map[string]interface{}{
map[string]interface{}{
{
"family_name": "fam",
"qualifier_prefixes": []string{"Y29s"},
},
Expand All @@ -120,7 +120,7 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) {
FamilySubsets: map[string]bigtable.FamilySubset{},
},
want: []map[string]interface{}{
map[string]interface{}{},
{},
},
orWant: nil,
},
Expand Down
2 changes: 0 additions & 2 deletions google/services/bigtable/resource_bigtable_gc_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ func GcPolicyToGCRuleString(gc bigtable.GCPolicy, topLevel bool) (map[string]int
} else {
result["max_version"] = version
}
break
case bigtable.PolicyUnion:
result["mode"] = "union"
rules := []interface{}{}
Expand All @@ -416,7 +415,6 @@ func GcPolicyToGCRuleString(gc bigtable.GCPolicy, topLevel bool) (map[string]int
rules = append(rules, gcRuleString)
}
result["rules"] = rules
break
case bigtable.PolicyIntersection:
result["mode"] = "intersection"
rules := []interface{}{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestUnitBigtable_flattenBigtableCluster(t *testing.T) {
"kms_key_name": "KMS",
"state": "CREATING",
"autoscaling_config": []map[string]interface{}{
map[string]interface{}{
{
"min_nodes": 3,
"max_nodes": 7,
"cpu_target": 50,
Expand Down
2 changes: 1 addition & 1 deletion google/services/bigtable/resource_bigtable_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func resourceBigtableTableUpdate(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("Error creating column family %q: %s", cfn, err)
}
}
for cfn, _ := range familyMapDiffKeys(oMap, nMap) {
for cfn := range familyMapDiffKeys(oMap, nMap) {
log.Printf("[DEBUG] removing column family %q", cfn)
if err := c.DeleteColumnFamily(ctx, name, cfn); err != nil {
return fmt.Errorf("Error deleting column family %q: %s", cfn, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func flattenCloudbuildWorkerPoolAnnotations(v map[string]string, d *schema.Resou

transformed := make(map[string]interface{})
if l, ok := d.Get("annotations").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ func flattenClouddeployDeliveryPipelineLabels(v map[string]string, d *schema.Res

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -1784,7 +1784,7 @@ func flattenClouddeployDeliveryPipelineTerraformLabels(v map[string]string, d *s

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -1799,7 +1799,7 @@ func flattenClouddeployDeliveryPipelineAnnotations(v map[string]string, d *schem

transformed := make(map[string]interface{})
if l, ok := d.Get("annotations").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
6 changes: 3 additions & 3 deletions google/services/clouddeploy/resource_clouddeploy_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ func flattenClouddeployTargetLabels(v map[string]string, d *schema.ResourceData)

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -1121,7 +1121,7 @@ func flattenClouddeployTargetTerraformLabels(v map[string]string, d *schema.Reso

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -1136,7 +1136,7 @@ func flattenClouddeployTargetAnnotations(v map[string]string, d *schema.Resource

transformed := make(map[string]interface{})
if l, ok := d.Get("annotations").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
6 changes: 2 additions & 4 deletions google/services/container/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1505,10 +1505,8 @@ func flattenResourceManagerTags(c *container.ResourceManagerTags) map[string]int

rmt := make(map[string]interface{})

if c != nil {
for k, v := range c.Tags {
rmt[k] = v
}
for k, v := range c.Tags {
rmt[k] = v
}

return rmt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ func flattenContainerAwsClusterAnnotations(v map[string]string, d *schema.Resour

transformed := make(map[string]interface{})
if l, ok := d.Get("annotations").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ func flattenContainerAwsNodePoolAnnotations(v map[string]string, d *schema.Resou

transformed := make(map[string]interface{})
if l, ok := d.Get("annotations").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ func flattenContainerAzureClusterAnnotations(v map[string]string, d *schema.Reso

transformed := make(map[string]interface{})
if l, ok := d.Get("annotations").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ func flattenContainerAzureNodePoolAnnotations(v map[string]string, d *schema.Res

transformed := make(map[string]interface{})
if l, ok := d.Get("annotations").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
4 changes: 2 additions & 2 deletions google/services/dataplex/resource_dataplex_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ func flattenDataplexAssetLabels(v map[string]string, d *schema.ResourceData) int

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -919,7 +919,7 @@ func flattenDataplexAssetTerraformLabels(v map[string]string, d *schema.Resource

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
4 changes: 2 additions & 2 deletions google/services/dataplex/resource_dataplex_lake.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ func flattenDataplexLakeLabels(v map[string]string, d *schema.ResourceData) inte

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -565,7 +565,7 @@ func flattenDataplexLakeTerraformLabels(v map[string]string, d *schema.ResourceD

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
4 changes: 2 additions & 2 deletions google/services/dataplex/resource_dataplex_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ func flattenDataplexZoneLabels(v map[string]string, d *schema.ResourceData) inte

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -741,7 +741,7 @@ func flattenDataplexZoneTerraformLabels(v map[string]string, d *schema.ResourceD

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4128,7 +4128,7 @@ func flattenDataprocWorkflowTemplateLabels(v map[string]string, d *schema.Resour

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -4143,7 +4143,7 @@ func flattenDataprocWorkflowTemplateTerraformLabels(v map[string]string, d *sche

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
4 changes: 2 additions & 2 deletions google/services/eventarc/resource_eventarc_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ func flattenEventarcTriggerLabels(v map[string]string, d *schema.ResourceData) i

transformed := make(map[string]interface{})
if l, ok := d.Get("labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand All @@ -937,7 +937,7 @@ func flattenEventarcTriggerTerraformLabels(v map[string]string, d *schema.Resour

transformed := make(map[string]interface{})
if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok {
for k, _ := range l {
for k := range l {
transformed[k] = v[k]
}
}
Expand Down
Loading

0 comments on commit 59c7f9b

Please sign in to comment.