Clarify comment

Remove an ambiguous part of the comment that can cause confusion -
passing a WaitGroup by pointer is always mandatory.
This commit is contained in:
Eli Bendersky 2021-09-10 07:19:33 -07:00
parent 8367c3ee2c
commit eac6776159
3 changed files with 4 additions and 8 deletions

View File

@ -23,8 +23,6 @@ func main() {
// This WaitGroup is used to wait for all the // This WaitGroup is used to wait for all the
// goroutines launched here to finish. Note: if a WaitGroup is // goroutines launched here to finish. Note: if a WaitGroup is
// explicitly passed into functions, it should be done *by pointer*. // explicitly passed into functions, it should be done *by pointer*.
// This would be important if, for example, our worker had to launch
// additional goroutines.
var wg sync.WaitGroup var wg sync.WaitGroup
// Launch several goroutines and increment the WaitGroup // Launch several goroutines and increment the WaitGroup

View File

@ -1,2 +1,2 @@
58031ceb701a1cab27498efd89adadbf1ea6b3e6 66d1c1cdb7e60f63b9b30938aa9c63b2262463ac
vmjCBfN6MJE S98GjeaGBX0

6
public/waitgroups generated
View File

@ -42,7 +42,7 @@ use a <em>wait group</em>.</p>
</td> </td>
<td class="code leading"> <td class="code leading">
<a href="http://play.golang.org/p/vmjCBfN6MJE"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" /> <a href="http://play.golang.org/p/S98GjeaGBX0"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<pre class="chroma"><span class="kn">package</span> <span class="nx">main</span> <pre class="chroma"><span class="kn">package</span> <span class="nx">main</span>
</pre> </pre>
</td> </td>
@ -107,9 +107,7 @@ use a <em>wait group</em>.</p>
<td class="docs"> <td class="docs">
<p>This WaitGroup is used to wait for all the <p>This WaitGroup is used to wait for all the
goroutines launched here to finish. Note: if a WaitGroup is goroutines launched here to finish. Note: if a WaitGroup is
explicitly passed into functions, it should be done <em>by pointer</em>. explicitly passed into functions, it should be done <em>by pointer</em>.</p>
This would be important if, for example, our worker had to launch
additional goroutines.</p>
</td> </td>
<td class="code leading"> <td class="code leading">