mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 03:34:15 +08:00
go关键字之后的匿名函数需要加上()
go关键字之后的匿名函数需要加上()
This commit is contained in:
@@ -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.
|
||||
```
|
||||
|
Reference in New Issue
Block a user