Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing waitgroups example #514

Closed
wants to merge 1 commit into from
Closed

Conversation

OmarQunsul
Copy link

Fixing waitgroups example.

Instead of printing

Worker 6 starting
Worker 6 starting
Worker 6 starting
Worker 6 starting
Worker 6 starting
Worker 6 done
Worker 6 done
Worker 6 done
Worker 6 done
Worker 6 done

It should print something like

Worker 5 starting
Worker 2 starting
Worker 4 starting
Worker 1 starting
Worker 3 starting
Worker 3 done
Worker 4 done
Worker 5 done
Worker 2 done
Worker 1 done

Fixing waitgroups example
@eliben
Copy link
Collaborator

eliben commented Mar 6, 2024

gobyexample assumes you use the latest version of Go, which is 1.22 right now

See https://go.dev/blog/loopvar-preview

@OmarQunsul OmarQunsul closed this Mar 6, 2024
@OmarQunsul
Copy link
Author

gobyexample assumes you use the latest version of Go, which is 1.22 right now

See https://go.dev/blog/loopvar-preview

I just updated my local go version to 1.22.1 and indeed the old code works as expected. Thank you for the link

@OmarQunsul OmarQunsul deleted the patch-1 branch March 6, 2024 20:37
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.

None yet

2 participants