Skip to content

Instantly share code, notes, and snippets.

@MortenDHansen
Created February 7, 2017 21:54
Show Gist options
  • Save MortenDHansen/eb23b52c5aea1b5588496f71be899f2d to your computer and use it in GitHub Desktop.
Save MortenDHansen/eb23b52c5aea1b5588496f71be899f2d to your computer and use it in GitHub Desktop.
GoLang ticker - every second for ... time
package main
import "time"
import "fmt"
func main() {
tickerChannel := time.NewTicker(1 * time.Second)
go func() {
for {
select {
case <-tickerChannel.C:
fmt.Println(" TICK ")
}
}
}()
time.Sleep(10 * time.Second)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment