Golang & Concurrency (50 Qs)•Part 4: Production Compilation, Tooling & Senior Engineering (39 - 50)
How does Go handle Panic across Goroutine Boundaries?
mid LevelGolang
In Simple Words:
A panic that occurs inside a spawned goroutine (go doWork()) CANNOT be caught by a recover() in the parent goroutine! If uncaught in the child goroutine, it crashes the entire process. Every spawned goroutine must have its own internal defer/recover guard if panic recovery is required.