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 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 for more information.
Found a possible issue in hanjm/file_download_proxy at tasks.go
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.
Click here to see the code in its original context.
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 for more information.
commit ID: 0c4562fdf2573853aaf635f514dee045324bae3e