github-vet / github-vet/rangeloop-pointer-findings
hscells/groove: analysis/reachability.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [hscells/groove](https://www.github.com/hscells/groove) at [analysis/reachability.go](https://github.com/hscells/groove/blob/8c20ac6a00a1c672d22742c32e84ec993b088fb3/analysis/reachability.go#L319-L329)
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 kw used in defer or goroutine at line 323
[Click here to see the code in its original context.](https://github.com/hscells/groove/blob/8c20ac6a00a1c672d22742c32e84ec993b088fb3/analysis/reachability.go#L319-L329)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, kw := range keywords {
wg1.Add(1)
go func(k cqr.Keyword) {
defer wg1.Done()
candidates, err := client.Candidates(kw.QueryString)
if err != nil {
return
}
queryCandidates = append(queryCandidates, candidates...)
}(kw)
}
```
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: 8c20ac6a00a1c672d22742c32e84ec993b088fb3
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with analysis/reachability.go around lines 319-329 and inspect how the goroutine uses the range-loop value versus its argument. Confirm the analyzer warning and verify that the reachability behavior remains correct after the captured value is handled safely.
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
- Mostly clear
- Newbie friendliness
- 42/100