Skip to content

Commit 184014b

Browse files
Merge pull request #176 from overmindtech/fix-shadowed-var
Fix shadowed var
2 parents cb9c321 + 713446b commit 184014b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

cmd/changes_get_change.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fetch:
109109
for {
110110
// use the variable to avoid shadowing
111111
var err error
112-
riskRes, err := client.GetChangeRisks(ctx, &connect.Request[sdp.GetChangeRisksRequest]{
112+
riskRes, err = client.GetChangeRisks(ctx, &connect.Request[sdp.GetChangeRisksRequest]{
113113
Msg: &sdp.GetChangeRisksRequest{
114114
UUID: changeUuid[:],
115115
},

cmd/changes_submit_plan.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func mappedItemDiffsFromPlan(ctx context.Context, fileName string, lf log.Fields
319319
return nil, fmt.Errorf("failed to parse '%v': %w", fileName, err)
320320
}
321321

322-
plannedChangeGroups := plannedChangeGroups{
322+
plannedChangeGroupsVar := plannedChangeGroups{
323323
supported: map[string][]*sdp.MappedItemDiff{},
324324
unsupported: map[string][]*sdp.MappedItemDiff{},
325325
}
@@ -343,7 +343,7 @@ func mappedItemDiffsFromPlan(ctx context.Context, fileName string, lf log.Fields
343343

344344
if len(mappings) == 0 {
345345
log.WithContext(ctx).WithFields(lf).WithField("terraform-address", resourceChange.Address).Debug("Skipping unmapped resource")
346-
plannedChangeGroups.Add(resourceChange.Type, &sdp.MappedItemDiff{
346+
plannedChangeGroupsVar.Add(resourceChange.Type, &sdp.MappedItemDiff{
347347
Item: itemDiff,
348348
MappingQuery: nil, // unmapped item has no mapping query
349349
})
@@ -461,7 +461,7 @@ func mappedItemDiffsFromPlan(ctx context.Context, fileName string, lf log.Fields
461461
}
462462
}
463463

464-
plannedChangeGroups.Add(resourceChange.Type, &sdp.MappedItemDiff{
464+
plannedChangeGroupsVar.Add(resourceChange.Type, &sdp.MappedItemDiff{
465465
Item: itemDiff,
466466
MappingQuery: newQuery,
467467
})
@@ -476,13 +476,13 @@ func mappedItemDiffsFromPlan(ctx context.Context, fileName string, lf log.Fields
476476
}
477477

478478
supported := ""
479-
numSupported := plannedChangeGroups.NumSupportedChanges()
479+
numSupported := plannedChangeGroupsVar.NumSupportedChanges()
480480
if numSupported > 0 {
481481
supported = Green.Color(fmt.Sprintf("%v supported", numSupported))
482482
}
483483

484484
unsupported := ""
485-
numUnsupported := plannedChangeGroups.NumUnsupportedChanges()
485+
numUnsupported := plannedChangeGroupsVar.NumUnsupportedChanges()
486486
if numUnsupported > 0 {
487487
unsupported = Yellow.Color(fmt.Sprintf("%v unsupported", numUnsupported))
488488
}
@@ -499,14 +499,14 @@ func mappedItemDiffsFromPlan(ctx context.Context, fileName string, lf log.Fields
499499
}
500500

501501
// Log the types
502-
for typ, plannedChanges := range plannedChangeGroups.supported {
502+
for typ, plannedChanges := range plannedChangeGroupsVar.supported {
503503
log.WithContext(ctx).Infof(Green.Color(" ✓ %v (%v)"), typ, len(plannedChanges))
504504
}
505-
for typ, plannedChanges := range plannedChangeGroups.unsupported {
505+
for typ, plannedChanges := range plannedChangeGroupsVar.unsupported {
506506
log.WithContext(ctx).Infof(Yellow.Color(" ✗ %v (%v)"), typ, len(plannedChanges))
507507
}
508508

509-
return plannedChangeGroups.MappedItemDiffs(), nil
509+
return plannedChangeGroupsVar.MappedItemDiffs(), nil
510510
}
511511

512512
func changeTitle(arg string) string {

0 commit comments

Comments
 (0)