github-vet / github-vet/rangeloop-pointer-findings
goodrain/rainbond: eventlog/store/new_monitor_message_store.go; 3 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [goodrain/rainbond](https://www.github.com/goodrain/rainbond) at [eventlog/store/new_monitor_message_store.go](https://github.com/goodrain/rainbond/blob/ba49a3f892bf79254c70b09faf7a362e1c257835/eventlog/store/new_monitor_message_store.go#L338-L340)
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.
> function call which takes a reference to c at line 339 may start a goroutine
[Click here to see the code in its original context.](https://github.com/goodrain/rainbond/blob/ba49a3f892bf79254c70b09faf7a362e1c257835/eventlog/store/new_monitor_message_store.go#L338-L340)
Click here to show the 3 line(s) of Go which triggered the analyzer.
```go
for _, c := range cache {
result.Add(&c)
}
```
Click here to show extra information the analyzer produced.
```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(Add, 1)" -> {"(DoRequest, 4)";"(Get, 2)";}
"(Get, 2)" -> {"(Proxy, 2)";}
"(Proxy, 2)" -> {}
"(DoRequest, 4)" -> {"(Do, 1)";}
"(Do, 1)" -> {"(AddTask, 1)";}
"(AddTask, 1)" -> {"(RunTask, 1)";}
"(RunTask, 1)" -> {}
}
```
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: ba49a3f892bf79254c70b09faf7a362e1c257835
Contributor guide
No contributing guide indexed for this repository
Research direction
Read eventlog/store/new_monitor_message_store.go around lines 338-340 and inspect how result.Add handles the reference. Determine whether the range-variable reference can escape into a goroutine, then classify the finding as Bug, Mitigated, or Desirable Behavior with a reaction.
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
- Clearly specified
- Newbie friendliness
- 45/100