Fix Tick example in slides
This commit is contained in:
parent
188819ffa5
commit
dec78a3841
1 changed files with 4 additions and 2 deletions
|
@ -361,8 +361,10 @@
|
||||||
func Tick(d time.Duration) <-chan time.Time {
|
func Tick(d time.Duration) <-chan time.Time {
|
||||||
ch := make(chan time.Time)
|
ch := make(chan time.Time)
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(d)
|
for {
|
||||||
ch <- time.Now()
|
time.Sleep(d)
|
||||||
|
ch <- time.Now()
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
return ch
|
return ch
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue