Created
January 29, 2018 03:31
-
-
Save dt665m/43090d8c3a68b6532f8b81c6ca261346 to your computer and use it in GitHub Desktop.
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 ( | |
"fmt" | |
"time" | |
) | |
func doEvery(d time.Duration, f func(time.Time)) { | |
for x := range time.Tick(d) { | |
f(x) | |
} | |
} | |
func main() { | |
doEvery(20*time.Millisecond, func(t time.Time) { | |
fmt.Println("hello world at: ", t) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment