github-vet / github-vet/rangeloop-pointer-findings
dan-v/rattlesnakeos-stack: cli/build.go; 29 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [dan-v/rattlesnakeos-stack](https://www.github.com/dan-v/rattlesnakeos-stack) at [cli/build.go](https://github.com/dan-v/rattlesnakeos-stack/blob/8839b54dfea7183b4893ca5de2e0016b72deccc6/cli/build.go#L171-L199)
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 region was used in a composite literal at line 172
[Click here to see the code in its original context.](https://github.com/dan-v/rattlesnakeos-stack/blob/8839b54dfea7183b4893ca5de2e0016b72deccc6/cli/build.go#L171-L199)
Click here to show the 29 line(s) of Go which triggered the analyzer.
```go
for _, region := range strings.Split(listRegions, ",") {
ec2Client := ec2.New(sess, &aws.Config{Region: ®ion})
resp, err := ec2Client.DescribeInstances(&ec2.DescribeInstancesInput{
Filters: []*ec2.Filter{
&ec2.Filter{
Name: aws.String("instance-state-name"),
Values: []*string{aws.String("running")}},
}})
if err != nil {
log.Fatalf("Failed to describe EC2 instances in region %v", region)
}
if len(resp.Reservations) == 0 || len(resp.Reservations[0].Instances) == 0 {
continue
}
for _, reservation := range resp.Reservations {
for _, instance := range reservation.Instances {
if instance.IamInstanceProfile == nil || instance.IamInstanceProfile.Arn == nil {
continue
}
instanceIamProfileName := strings.Split(*instance.IamInstanceProfile.Arn, "/")[1]
if instanceIamProfileName == name+"-ec2" {
log.Printf("Instance '%v': ip='%v' region='%v' launched='%v'", *instance.InstanceId, *instance.PublicIpAddress, region, *instance.LaunchTime)
runningInstances++
}
}
}
}
```
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: 8839b54dfea7183b4893ca5de2e0016b72deccc6
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.