1
0
mirror of https://github.com/kidoman/embd synced 2024-12-21 20:30:05 +01:00

moving ticker.Stop to defer statement when creating ticker

This commit is contained in:
Ben Schwartz 2015-03-31 20:22:47 -05:00
parent 333194b96f
commit 3574e65c8d

View File

@ -74,6 +74,7 @@ func main() {
// Start main loop
ticker := time.NewTicker(time.Duration(*stepDelay) * time.Millisecond)
defer ticker.Stop()
var stepCounter int
for {
@ -102,7 +103,6 @@ func main() {
}
case <-quit:
ticker.Stop()
return
}
}