Skip to content

fix(docs): Correct first output example in Goroutine.md#9

Open
KiwiGaze wants to merge 1 commit into
Percygu:mainfrom
KiwiGaze:fix/goroutine-first-output
Open

fix(docs): Correct first output example in Goroutine.md#9
KiwiGaze wants to merge 1 commit into
Percygu:mainfrom
KiwiGaze:fix/goroutine-first-output

Conversation

@KiwiGaze

Copy link
Copy Markdown

Summary

The first code example in Goroutine.md demonstrates that when the main goroutine exits, child goroutines are terminated before they can run. However, the output block incorrectly showed both end!!! and myGroutine, contradicting the explanation that follows ("为什么只打印了主协程里的'end!!!'").

Fixed by removing the myGroutine line from the first output block so it only shows end!!!, matching the expected behavior of the code (no time.Sleep, so the main goroutine exits before the child runs).

Review / Merge checklist

  • PR title and summary are descriptive
  • Docs updated or follow-up ticket created
  • No tests needed (documentation fix)

The first example has no time.Sleep, so the main goroutine exits
before myGroutine runs. The output block incorrectly showed both
lines; it should only show "end!!!".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant