![无标题2.png](https://static.studygolang.com/171201/82cd80f1c581c116d680709b9b1bca45.png)
执行结果:
In f
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc42000e23c)
/home/zenglin/Downloads/go1.8/src/runtime/sema.go:47 +0x34
sync.(*WaitGroup).Wait(0xc42000e230)
/home/zenglin/Downloads/go1.8/src/sync/waitgroup.go:131 +0x7a
main.main()
/mnt/hgfs/src/test/test1.go:10 +0x80
exit status 2
修改两个地方:<br/>
(1)go f(**wg**) --> go f(**&wg**);<br/>
(2)func f(**wg sync.WaitGroup**) --> func f(**wg *sync.WaitGroup**) .
#1