github-vet / github-vet/rangeloop-pointer-findings
integr8ly/cluster-service: pkg/aws/manager_elasticache.go; 30 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [integr8ly/cluster-service](https://www.github.com/integr8ly/cluster-service) at [pkg/aws/manager_elasticache.go](https://github.com/integr8ly/cluster-service/blob/60f20b52d665180bb7c5f06e8a06ab390b619db9/pkg/aws/manager_elasticache.go#L127-L156)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> reference to subnetGroupName was used in a composite literal at line 143
[Click here to see the code in its original context.](https://github.com/integr8ly/cluster-service/blob/60f20b52d665180bb7c5f06e8a06ab390b619db9/pkg/aws/manager_elasticache.go#L127-L156)
Click here to show the 30 line(s) of Go which triggered the analyzer.
```go
for _, subnetGroupName := range r.subnetGroupsToDelete {
sgLogger := logger.WithField("subnetGroup", aws.String(subnetGroupName))
sgLogger.Debugf("building report for cache subnet groups")
reportItem := &clusterservice.ReportItem{
ID: fmt.Sprintf("subnetgroup:%s", subnetGroupName),
Name: "elasticache subnet group",
Action: clusterservice.ActionDelete,
ActionStatus: clusterservice.ActionStatusInProgress,
}
reportItems = append(reportItems, reportItem)
if dryRun {
sgLogger.Debug("dry run enabled, skipping deletion step")
reportItem.ActionStatus = clusterservice.ActionStatusDryRun
continue
}
deleteSubnetGroupInput := &elasticache.DeleteCacheSubnetGroupInput{
CacheSubnetGroupName: &subnetGroupName,
}
if _, err := r.elasticacheClient.DeleteCacheSubnetGroup(deleteSubnetGroupInput); err != nil {
if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "CacheSubnetGroupInUse" {
sgLogger.Debug("cache subnet group is still in use, skipping")
reportItem.ActionStatus = clusterservice.ActionStatusSkipped
// push the subnetGroup into the list of groups to be deleted next time
nextSubnetGroupsToDelete = append(nextSubnetGroupsToDelete, subnetGroupName)
continue
}
return nil, errors.WrapLog(err, "failed to delete cache subnet group", sgLogger)
}
reportItem.ActionStatus = clusterservice.ActionStatusComplete
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 60f20b52d665180bb7c5f06e8a06ab390b619db9
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.