File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -238,9 +238,16 @@ func (wg *WaitGroup) Go(f func()) {
238238 go func () {
239239 defer func () {
240240 if x := recover (); x != nil {
241- // Don't call Done as it may cause Wait to unblock,
242- // so that the main goroutine races with the runtime.fatal
243- // resulting from unhandled panic.
241+ // f panicked, which will be fatal because
242+ // this is a new goroutine.
243+ //
244+ // Calling Done will unblock Wait in the main goroutine,
245+ // allowing it to race with the fatal panic and
246+ // possibly even exit the process (os.Exit(0))
247+ // before the panic completes.
248+ //
249+ // This is almost certainly undesirable,
250+ // so instead avoid calling Done and simply panic.
244251 panic (x )
245252 }
246253
You can’t perform that action at this time.
0 commit comments