Today I needed a solution to cleanup and stop all goroutines and wait until they returned. I found various patterns…