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

Fixed bug in WaitGroup example #1809

Merged
merged 1 commit into from
Apr 4, 2022
Merged

Conversation

deefstes
Copy link
Contributor

The waitgroup that is defined in main() with var wg sync.WaitGroup, only has scope inside the main() function. The doOperation() function will not know about it and so the defer wg.Done() line will result in a compile time error. The waitgroup needs to be passed as a parameter to the doOperation() function.

The waitgroup that is defined in main() with var wg sync.WaitGroup, only has scope inside the main() function. The doOperation() function will not know about it and so the defer wg.Done() line will result in a compile time error. The waitgroup needs to be passed as a parameter to the doOperation() function.
@rstacruz rstacruz merged commit 5a312cd into rstacruz:master Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants