On Thu, May 14, 2020 at 8:18 AM sperberstephan via golang-nuts <golang-nuts@googlegroups.com> wrote: > Here: > https://play.golang.org/p/76AzuAiVGxL > > I thougt If the waitgroup gets below 0 there should be a Panic. > I understand that the goroutine is canceled. So maybe the defer Statement is > Not executed. > But why is there No warning at the end of Main that some goroutines Had to be > canceled?
wg.Wait at line 18 does not wait for anything and the program exists before the goroutine executing func worker even starts. IOW, wg.Done at line 10 is not executed hence no panic. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-Wd3PzEqG-9xjYT8_qAvR8KEKDwYSMz_YgN-5KhSBrKKA%40mail.gmail.com.