awesome-patterns/concurrency/select_block/main.go

24 lines
236 B
Go
Raw Normal View History

2018-01-06 19:04:06 +03:00
package main
import (
"time"
"github.com/davecgh/go-spew/spew"
)
func main() {
a := make(chan string)
go func() {
time.Sleep(time.Second * 2)
test := "string"
a <- test
}()
select {
case t := <-a:
spew.Dump(t)
}
}