Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/goroutine-exit.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ Given a goroutine spawned by the system,
there must be a way to wait for the goroutine to exit.
There are two popular ways to do this:

- Use a `sync.WaitGroup`.
Do this if there are multiple goroutines that you want to wait for
- Use a `sync.WaitGroup`, which does this with `Go` and `Wait`.
Comment thread
moisesvega marked this conversation as resolved.
Outdated
Do this if there are multiple goroutines that you want to wait for.

```go
var wg sync.WaitGroup
for i := 0; i < N; i++ {
wg.Add(1)
go func() {
defer wg.Done()
// ...
}()
wg.Go(...)
}

// To wait for all to finish:
Expand Down
10 changes: 3 additions & 7 deletions style.md
Original file line number Diff line number Diff line change
Expand Up @@ -2039,17 +2039,13 @@ Given a goroutine spawned by the system,
there must be a way to wait for the goroutine to exit.
There are two popular ways to do this:

- Use a `sync.WaitGroup`.
Do this if there are multiple goroutines that you want to wait for
- Use a `sync.WaitGroup`, which does this with `Go` and `Wait`.
Comment thread
moisesvega marked this conversation as resolved.
Outdated
Do this if there are multiple goroutines that you want to wait for.

```go
var wg sync.WaitGroup
for i := 0; i < N; i++ {
wg.Add(1)
go func() {
defer wg.Done()
// ...
}()
wg.Go(...)
}

// To wait for all to finish:
Expand Down