timer-reset-drain-race
Default severity: error
Using time.Timer.Reset’s boolean result to decide whether to receive from the
timer channel is racy on older timer implementations and can block with
current synchronous timer channels. Stop and drain before resetting when
compatibility requires it, or reset without conditionally draining afterward.
if !timer.Reset(delay) { <-timer.C }if !timer.Stop() { select { case <-timer.C: default: } }timer.Reset(delay)