By this point, we should have developed a good understanding of how goroutines and the scheduler works. Let's now look at a few things that may catch us by surprise while working with goroutines.
Gotchas when using goroutines
Single goroutine halting the complete program
We know that goroutines run across multiple threads and multiple cores. So what happens when we have a panic in one of the threads? Here is an example that would let us simulate such a situation. We will create a lot of similar goroutines, whose sole purpose is to take a number and divide it by itself after subtracting 10 from the denominator. This will work fine for the majority of cases, except when the number is 10. The following code implements the...