Created
February 7, 2017 21:54
-
-
Save MortenDHansen/eb23b52c5aea1b5588496f71be899f2d to your computer and use it in GitHub Desktop.
GoLang ticker - every second for ... time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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