github-vet / github-vet/rangeloop-pointer-findings
wanyuenmei/di: provider/awsSpot.go; 34 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [wanyuenmei/di](https://www.github.com/wanyuenmei/di) at [provider/awsSpot.go](https://github.com/wanyuenmei/di/blob/fcac249d8c7296db44a101015482b06055e71d0a/provider/awsSpot.go#L115-L148)
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 count was used in a composite literal at line 136
[Click here to see the code in its original context.](https://github.com/wanyuenmei/di/blob/fcac249d8c7296db44a101015482b06055e71d0a/provider/awsSpot.go#L115-L148)
Click here to show the 34 line(s) of Go which triggered the analyzer.
```go
for br, count := range bootReqMap {
bd := &ec2.BlockDeviceMapping{
DeviceName: aws.String("/dev/sda1"),
Ebs: &ec2.EbsBlockDevice{
DeleteOnTermination: aws.Bool(true),
VolumeSize: aws.Int64(int64(br.diskSize)),
VolumeType: aws.String("gp2"),
},
}
session := clst.getSession(br.region)
cloudConfig64 := base64.StdEncoding.EncodeToString([]byte(br.cfg))
resp, err := session.RequestSpotInstances(&ec2.RequestSpotInstancesInput{
SpotPrice: aws.String(spotPrice),
LaunchSpecification: &ec2.RequestSpotLaunchSpecification{
ImageId: aws.String(amis[br.region]),
InstanceType: aws.String(br.size),
UserData: &cloudConfig64,
SecurityGroups: []*string{&clst.namespace},
BlockDeviceMappings: []*ec2.BlockDeviceMapping{bd},
},
InstanceCount: &count,
})
if err != nil {
return err
}
for _, request := range resp.SpotInstanceRequests {
awsIDs = append(awsIDs, awsID{
spotID: *request.SpotInstanceRequestId,
region: br.region})
}
}
```
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: fcac249d8c7296db44a101015482b06055e71d0a
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.