I am probably mis-understanding or missing something. The golang spec <https://golang.org/ref/spec#Program_execution> says: Program execution begins by initializing the main package and then invoking the function main. When that function invocation returns, the program exits. *It does not wait for other (non-main) goroutines to complete*.
I gather that the context mechanism addresses this issue, by requiring every relevant go routine to get a context as a parameter and to check for ctx.Done channel. Since calling cancel() would send a message through that channel, every goroutine that is designed to listen on that channel would 'get the message' and can do their own cleanup/exit. However, this specific goroutine does not receive the context. The golang spec seems to say that it is not guaranteed to exit when the app dies or exits. Please clarify. Regards, Sundar On Wednesday, January 24, 2018 at 12:05:35 PM UTC-8, Tamás Gulácsi wrote: > > if the main goroutine exits, all other goroutines exit, too. -- 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. For more options, visit https://groups.google.com/d/optout.