github-vet / github-vet/rangeloop-pointer-findings

cycloidio/terracognita: aws/resources.go; 33 LoC

Open
#14,556 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [cycloidio/terracognita](https://www.github.com/cycloidio/terracognita) at [aws/resources.go](https://github.com/cycloidio/terracognita/blob/65208ceea0f22f42366fd128bdee12cd15f32ea1/aws/resources.go#L1839-L1871)

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 d was used in a composite literal at line 1844

[Click here to see the code in its original context.](https://github.com/cycloidio/terracognita/blob/65208ceea0f22f42366fd128bdee12cd15f32ea1/aws/resources.go#L1839-L1871)

Click here to show the 33 line(s) of Go which triggered the analyzer.

```go
for _, d := range domainNames {
// We could just pass domainNames as Identities
// but then we would not not which NotificationAttributes
// is of each identity so we have to do it one by one
input := &ses.GetIdentityNotificationAttributesInput{
Identities: []*string{&d},
}

sesIdentityNotificationTopics, err := a.awsr.GetIdentityNotificationAttributes(ctx, input)
if err != nil {
return nil, err
}

for _, i := range sesIdentityNotificationTopics {
var notType string
if i.BounceTopic != nil {
notType = ses.NotificationTypeBounce
} else if i.ComplaintTopic != nil {
notType = ses.NotificationTypeComplaint
} else if i.DeliveryTopic != nil {
notType = ses.NotificationTypeDelivery
} else {
// We need the topic, if fore some reason we do not have
// it we have to continue to the next one
continue
}
r, err := initializeResource(a, fmt.Sprintf("%s|%s", d, notType), resourceType)
if err != nil {
return nil, err
}
resources = append(resources, r)
}
}

```

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: 65208ceea0f22f42366fd128bdee12cd15f32ea1

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.