github-vet / github-vet/rangeloop-pointer-findings
billowjen/cke: kubernetes/cluster/cluster.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [billowjen/cke](https://www.github.com/billowjen/cke) at [kubernetes/cluster/cluster.go](https://github.com/billowjen/cke/blob/6ebf94f485b4ecc7e38ae8ec2575cf0ed0794df1/kubernetes/cluster/cluster.go#L692-L711)
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.
> range-loop variable name used in defer or goroutine at line 704
[Click here to see the code in its original context.](https://github.com/billowjen/cke/blob/6ebf94f485b4ecc7e38ae8ec2575cf0ed0794df1/kubernetes/cluster/cluster.go#L692-L711)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, name := range nodeNames {
kn := c.GetKubeNodeByName(&name)
//先从k8s集群中清除节点
removeChan := kn.clearNodeFromK8s(c)
//删除节点时可能会返回等待用的removeChan,等待节点将自己从API Srver中删除
//如果为空则表示进程已经是停止状态
if removeChan != nil {
log.Infof("Waiting for clear node %s from K8s", name)
//创建协程,等待移除节点任务执行完成,从cluster.KubeNodes中删除
go func(toDeleteNode *KubeNode, removeChan <-chan ListenType) {
listenEvent := <-removeChan
if listenEvent == Listen_Started {
log.Infof("Cleared node %s from K8s", name)
c._deleteNode(kn, waitAllNodesDeleted)
}
}(kn, removeChan)
} else {
c._deleteNode(kn, waitAllNodesDeleted)
}
}
```
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: 6ebf94f485b4ecc7e38ae8ec2575cf0ed0794df1
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.