go关键字之后的匿名函数需要加上()

go关键字之后的匿名函数需要加上()
This commit is contained in:
htlhenry
2017-02-15 17:39:44 +08:00
committed by GitHub
parent ce79b426f6
commit 8d85f78031

View File

@@ -281,7 +281,7 @@ ch := make(chan int)
go func(){
// doSomething
ch <- 1 // Send a signal; value does not matter
}
}()
doSomethingElseForAWhile()
<- ch // Wait for goroutine to finish; discard sent value.
```