Guest User

Untitled

a guest
Jul 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "time"
  6. )
  7.  
  8. func doEvery(d time.Duration, f func(time.Time)) {
  9. for x := range time.Tick(d) {
  10. f(x)
  11. }
  12. }
  13.  
  14. func helloworld(t time.Time) {
  15. fmt.Printf("%v: Hello, World!\n", t)
  16. }
  17.  
  18. func main() {
  19. doEvery(2*time.Second, helloworld)
  20. }
Add Comment
Please, Sign In to add comment