gofmt wat u know about it
This commit is contained in:
@@ -8,27 +8,27 @@ import "fmt"
|
||||
func main() {
|
||||
c1 := make(chan string)
|
||||
c2 := make(chan string)
|
||||
d := make(chan bool, 1)
|
||||
d := make(chan bool, 1)
|
||||
|
||||
go func() {
|
||||
time.Sleep(time.Second * 1)
|
||||
c1 <- "from 1"
|
||||
c1 <- "from 1"
|
||||
}()
|
||||
go func() {
|
||||
time.Sleep(time.Second * 2)
|
||||
c2 <- "from 2"
|
||||
c2 <- "from 2"
|
||||
}()
|
||||
|
||||
go func() {
|
||||
for i :=0; i < 2; i ++ {
|
||||
for i := 0; i < 2; i++ {
|
||||
select {
|
||||
case msg1 := <- c1:
|
||||
case msg1 := <-c1:
|
||||
fmt.Println(msg1)
|
||||
case msg2 := <- c2:
|
||||
case msg2 := <-c2:
|
||||
fmt.Println(msg2)
|
||||
}
|
||||
}
|
||||
d <- true
|
||||
d <- true
|
||||
}()
|
||||
<- d
|
||||
<-d
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user