github-vet / github-vet/rangeloop-pointer-findings
sensiblecodeio/hookbot: pkg/hookbot/hookbot.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [sensiblecodeio/hookbot](https://www.github.com/sensiblecodeio/hookbot) at [pkg/hookbot/hookbot.go](https://github.com/sensiblecodeio/hookbot/blob/0a597c35449f3f781f19ab874334da1d9bf6ade7/pkg/hookbot/hookbot.go#L316-L326)
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 topic used in defer or goroutine at line 321
[Click here to see the code in its original context.](https://github.com/sensiblecodeio/hookbot/blob/0a597c35449f3f781f19ab874334da1d9bf6ade7/pkg/hookbot/hookbot.go#L316-L326)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, topic := range r.Topics() {
h.wg.Add(1)
go func() {
defer h.wg.Done()
l := h.Add(topic)
for m := range l.c {
r.Route(m, h.Publish)
}
}()
}
```
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: 0a597c35449f3f781f19ab874334da1d9bf6ade7
Contributor guide
No contributing guide indexed for this repository
Research direction
Read pkg/hookbot/hookbot.go around lines 316-326 and inspect how the range variable topic is used inside the goroutine. Determine whether the captured value can produce incorrect behavior, then classify the finding as Bug, Mitigated, or Desirable Behavior using the project’s stated criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100