mmcgrana / gobyexample

Go by Example
https://gobyexample.com
7.16k stars 1.26k forks source link

Go by Example: WaitGroups: fmt.Print not safe for parallel output #505

Closed bahco closed 7 months ago

bahco commented 7 months ago

If I understand https://stackoverflow.com/questions/14694088/is-it-safe-for-more-than-one-goroutine-to-print-to-stdout correctly, fmt.Print not safe for parallel output.

If the quoted answer and my understanding of it are correct you may want to adapt your WaitGroups example.

eliben commented 7 months ago

Thanks for the note; I think this is OK for an example - the point here is showing WaitGroup, so the fmt.Prints are just for demonstartion purposes.