Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/mao888/golang-guide
/ hello2
Function
hello2
golang/go-study/go语言基础/并发/goroutine/启动多个goroutine.go:10–13 ·
view source on GitHub ↗
(i int)
Source
from the content-addressed store, hash-verified
8
var
wg2 sync.WaitGroup
9
10
func
hello2(i int) {
11
defer
wg2.Done()
// goroutine结束就登记-1
12
fmt.Println(
"hello"
, i)
13
}
14
15
func
main() {
16
for
i := 0; i < 10; i++ {
Callers
1
main
Function · 0.85
Calls
1
Done
Method · 0.80
Tested by
no test coverage detected