Merge pull request #328 from htlhenry/patch-3

go关键字之后的匿名函数需要加上()
This commit is contained in:
无闻
2017-02-15 05:01:01 -05:00
committed by GitHub

View File

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