Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/mao888/golang-guide
/ hello
Function
hello
golang/go-study/go语言基础/并发/goroutine/启动单个goroutine.go:15–18 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
13
var
wg sync.WaitGroup
14
15
func
hello() {
16
fmt.Println(
"hello"
)
17
wg.Done()
// 告知当前goroutine完成
18
}
19
20
func
main() {
21
wg.Add(1)
// 登记一个goroutine
Callers
1
main
Function · 0.70
Calls
1
Done
Method · 0.80
Tested by
no test coverage detected