github-vet / github-vet/rangeloop-pointer-findings
vmware/purser: pkg/controller/eventprocessor/sync.go; 6 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [vmware/purser](https://www.github.com/vmware/purser) at [pkg/controller/eventprocessor/sync.go](https://github.com/vmware/purser/blob/fe465499996964cf7fdb64f8045724f7433e9617/pkg/controller/eventprocessor/sync.go#L63-L68)
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 pod is reassigned at line 66
[Click here to see the code in its original context.](https://github.com/vmware/purser/blob/fe465499996964cf7fdb64f8045724f7433e9617/pkg/controller/eventprocessor/sync.go#L63-L68)
Click here to show the 6 line(s) of Go which triggered the analyzer.
```go
for _, pod := range podsInCluster.Items {
xid := pod.Namespace + ":" + pod.Name
if _, isPresent := podXIDToPod[xid]; !isPresent {
podXIDToPod[xid] = &pod
}
}
```
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: fe465499996964cf7fdb64f8045724f7433e9617
Contributor guide
No contributing guide indexed for this repository
Research direction
Open pkg/controller/eventprocessor/sync.go at lines 63-68 and read the surrounding loop and map usage. Check whether storing &pod preserves the intended item or aliases the range variable, then classify the finding as Bug, Mitigated, or Desirable Behavior based on the referenced commit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100