DEV Community

Discussion on: Leveraging the Layer-cake design in Go

bgadrian profile image
Adrian B.G.

A few notes

Goroutines are not threads, you can use the term lightweight threads but that also could confuse the devs that does not know what they actually mean.

Os.Exit is not actually fine, the other layers may remain in memory processing and doing their stuff on different system threads. You need to send the shutdown signal to all your layers and goroutines. Easiest way is by cancelling a Context.

virepri profile image
Adele Reed Author • Edited

I appreciate the feedback, man.

I understand goroutines aren't threads on their own, and that they're more akin to scheduled tasks.

And I actually didn't know that there were lingering side-effects of os.Exit (the docs don't exactly go into that), thanks for pointing that out.