github-vet / github-vet/rangeloop-pointer-findings
hanjm/file_download_proxy: tasks.go; 18 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [hanjm/file_download_proxy](https://www.github.com/hanjm/file_download_proxy) at [tasks.go](https://github.com/hanjm/file_download_proxy/blob/0c4562fdf2573853aaf635f514dee045324bae3e/tasks.go#L272-L289)
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 task used in defer or goroutine at line 281
[Click here to see the code in its original context.](https://github.com/hanjm/file_download_proxy/blob/0c4562fdf2573853aaf635f514dee045324bae3e/tasks.go#L272-L289)
Click here to show the 18 line(s) of Go which triggered the analyzer.
```go
for _, task := range m.tasks {
if !task.IsCompleted() {
log.Infof("ReDownloadUncompleted task:%s", task.FileName())
go func(m *TasksManager) {
defer func() {
if rec := recover(); rec != nil {
log.Errorf("download worker panic:%s", rec)
}
}()
os.Remove(m.downloadDir + "/" + task.FileName())
err := task.Download(m.downloadDir, m.limitByteSize, m.limitTimeout)
if err != nil {
log.Errorf("task download error:%s, task name:%s", err, task.FileName())
}
m.PushTasksUpdate()
}(m)
}
}
```
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: 0c4562fdf2573853aaf635f514dee045324bae3e
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.