1
0
Fork 0
mirror of https://github.com/vbatts/talks.git synced 2024-12-26 16:46:31 +00:00
talks/2013/03-golang-learning-lunch/12-go-func/main.go

31 lines
507 B
Go
Raw Normal View History

2016-12-05 15:44:45 +00:00
package main
import (
"fmt"
"time"
)
// START OMIT
func DelayedHello() {
time.Sleep(3 * time.Second)
fmt.Printf("%d: Hello!\n", time.Now().Unix())
}
func main() {
go DelayedHello()
go DelayedHello()
go func() {
time.Sleep(3 * time.Second)
fmt.Printf("%d: Hello!\n", time.Now().Unix())
}()
fmt.Printf("%d: Is there anybody in there?!\n", time.Now().Unix())
for i := 0; i < 5; i++ {
fmt.Printf("%d: .\n", time.Now().Unix())
time.Sleep(time.Second)
}
}
// STOP OMIT