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
1 changed files with 1 additions and 1 deletions

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
}
}