github-vet / github-vet/rangeloop-pointer-findings
beito123/medaka: scheduler/scheduler.go; 37 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [beito123/medaka](https://www.github.com/beito123/medaka) at [scheduler/scheduler.go](https://github.com/beito123/medaka/blob/82c12f019c17f6c376a4100a90409f7d380159ed/scheduler/scheduler.go#L165-L201)
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 hand used in defer or goroutine at line 182
[Click here to see the code in its original context.](https://github.com/beito123/medaka/blob/82c12f019c17f6c376a4100a90409f7d380159ed/scheduler/scheduler.go#L165-L201)
Click here to show the 37 line(s) of Go which triggered the analyzer.
```go
for i, hand := range sche.queue {
if tick.Before(hand.NextRun) { // if tick is earlier than hand
continue
}
sche.removeQueue(i)
if hand.IsCanceled() {
delete(sche.tasks, hand.ID())
continue
}
crashed := false
defer func() {
if err := recover(); err != nil {
crashed = true
sche.Logger.Warnf("Happened a problem while task %s running Error:%s", hand.Name(), err)
sche.Logger.Trace(nil)
}
}()
hand.Run(tick)
if hand.IsRepeating() {
if crashed {
sche.Logger.Debugf("Dropping repeating task %s due to an error happened while running", hand.Name())
} else {
hand.NextRun = tick.Add(hand.Period())
sche.queue = append(sche.queue, hand)
continue
}
}
hand.Remove()
delete(sche.tasks, hand.ID())
}
```
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: 82c12f019c17f6c376a4100a90409f7d380159ed
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.