These simple go tests check the "leaky-ness" of using channels in Go.
There are two methods described here; one using both a local context, and the parent context.
When tests are run against both, the LeakyAsync
method runs faster, but fails the leak checker
as goroutines are not resolved or cleaned up.
In a production system with possibly thousands of go routines being spun up, this could result in massive memory leaks and a deadlock situation in the go binary.
it's recommended to use the leakchecker
library to determine if goroutines get cleaned up.