github-vet / github-vet/rangeloop-pointer-findings
Andyfoo/go-xutils: xthread/xthread.go; 8 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Andyfoo/go-xutils](https://www.github.com/Andyfoo/go-xutils) at [xthread/xthread.go](https://github.com/Andyfoo/go-xutils/blob/2ae54c624cca05de6b575f3a20c688e1cd75a18e/xthread/xthread.go#L44-L51)
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 fun1 used in defer or goroutine at line 49
[Click here to see the code in its original context.](https://github.com/Andyfoo/go-xutils/blob/2ae54c624cca05de6b575f3a20c688e1cd75a18e/xthread/xthread.go#L44-L51)
Click here to show the 8 line(s) of Go which triggered the analyzer.
```go
for _, fun1 := range t.taskFuns {
//xlog.Info("run task:", k)
t.waitGroup.Add(1)
go func() {
defer t.waitGroup.Done()
ch1 <- fun1()
}()
}
```
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: 2ae54c624cca05de6b575f3a20c688e1cd75a18e
Contributor guide
No contributing guide indexed for this repository
Research direction
Review xthread/xthread.go at lines 44-51 and inspect how the goroutine uses the range-loop variable fun1. Determine whether each goroutine invokes its intended task function, considering the analyzer's range-loop capture warning. Done means classifying the finding as a bug, mitigated issue, or desirable behavior with supporting evidence.
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
- 48/100