To clarify what Jan said, a Go program exits when main() exits. Since `wg` 
has a count of 0, the call to wg.Wait() on like 18 doe not wat, so the 
program exits before your goroutine even has time to run. With slight 
modification, it does panic as expected: 
https://play.golang.org/p/ivcfhsu1N9K

On Thursday, May 14, 2020 at 2:18:56 AM UTC-4, sperber...@googlemail.com 
wrote:
>
> Hi Folks, 
>
> 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? 
>
> Thx 
> Yours 
> Stephan

-- 
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/3311b64f-d0e2-4e1c-a3e2-d94942b1affc%40googlegroups.com.

Reply via email to