github-vet / github-vet/rangeloop-pointer-findings
zhangxiaoyu-zidif/k8s-lose-weight: plugin/pkg/scheduler/algorithm/predicates/predicates.go; 12 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [zhangxiaoyu-zidif/k8s-lose-weight](https://www.github.com/zhangxiaoyu-zidif/k8s-lose-weight) at [plugin/pkg/scheduler/algorithm/predicates/predicates.go](https://github.com/zhangxiaoyu-zidif/k8s-lose-weight/blob/10f703c4ad389a49b8974a9f2afa9423fb22a1fb/plugin/pkg/scheduler/algorithm/predicates/predicates.go#L998-L1009)
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 term was used in a composite literal at line 1007
[Click here to see the code in its original context.](https://github.com/zhangxiaoyu-zidif/k8s-lose-weight/blob/10f703c4ad389a49b8974a9f2afa9423fb22a1fb/plugin/pkg/scheduler/algorithm/predicates/predicates.go#L998-L1009)
Click here to show the 12 line(s) of Go which triggered the analyzer.
```go
for _, term := range getPodAntiAffinityTerms(affinity.PodAntiAffinity) {
namespaces := priorityutil.GetNamespacesFromPodAffinityTerm(pod, &term)
selector, err := unversioned.LabelSelectorAsSelector(term.LabelSelector)
if err != nil {
catchError(err)
return
}
match := priorityutil.PodMatchesTermsNamespaceAndSelector(pod, namespaces, selector)
if match {
nodeResult = append(nodeResult, matchingPodAntiAffinityTerm{term: &term, node: node})
}
}
```
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: 10f703c4ad389a49b8974a9f2afa9423fb22a1fb
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading plugin/pkg/scheduler/algorithm/predicates/predicates.go around lines 998-1009 and inspect the reported range-loop reference in context. Determine whether the analyzer finding is a bug, mitigated, or desirable behavior, then record the corresponding reaction on this issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100