sync package of golang provides WaitGroup struct which can be used to wait for collection of goroutines to finish execution. The WaitGroup provides: Add method to set the number of goroutines to…
Tag: goroutines
Get number of currently running/active goroutines
NumGoroutine function of runtime package can be used to know the currently running/active goroutines. https://golang.org/pkg/runtime/#NumGoroutine Below is the signature of the function Working Code: Output: