github-vet / github-vet/rangeloop-pointer-findings
WeBankPartners/wecube-plugins-qcloud: plugins/clb_target.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [WeBankPartners/wecube-plugins-qcloud](https://www.github.com/WeBankPartners/wecube-plugins-qcloud) at [plugins/clb_target.go](https://github.com/WeBankPartners/wecube-plugins-qcloud/blob/81fcf0e7b0d6bf733572823782d1bf6be7327663/plugins/clb_target.go#L271-L292)
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 hostId was used in a composite literal at line 274
[Click here to see the code in its original context.](https://github.com/WeBankPartners/wecube-plugins-qcloud/blob/81fcf0e7b0d6bf733572823782d1bf6be7327663/plugins/clb_target.go#L271-L292)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for index, hostId := range hostIds {
hostPort, _ := strconv.ParseInt(hostPorts[index], 10, 64)
describeInstancesParams := cvm.DescribeInstancesRequest{
InstanceIds: []*string{&hostId},
}
clientCvm, _ := createCvmClient(paramsMap["Region"], paramsMap["SecretID"], paramsMap["SecretKey"])
var describeInstancesResponse *cvm.DescribeInstancesResponse
describeInstancesResponse, err = describeInstancesFromCvm(clientCvm, describeInstancesParams)
if err != nil {
logrus.Errorf("describeInstancesFromCvm meet error=%v", err)
return
}
if len(describeInstancesResponse.Response.InstanceSet) == 0 {
logrus.Errorf("hostId=[%v] is not existed", hostId)
err = fmt.Errorf("hostId=[%v] is not existed", hostId)
return
}
if err = ensureAddListenerBackHost(client, input.LbId, listenerId, hostId, hostPort); err != nil {
logrus.Errorf("ensureAddListenerBackHost meet error=%v", err)
return
}
}
```
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: 81fcf0e7b0d6bf733572823782d1bf6be7327663
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect plugins/clb_target.go lines 271-292 at commit 81fcf0e7b0d6bf733572823782d1bf6be7327663 and the surrounding hostIds loop. Confirm the analyzer finding against the repository's tests or a focused reproduction if available. Done means determining whether the finding is a bug, mitigated, or desirable behavior and leaving the requested reaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100