How many goroutines are actively running, or how many goroutines
actually exist? The number of goroutines actively running is the number
of M structures that are running. Look at runtime·sched for various
useful counts and lists.
To find the goroutines that exist, whether or not they are running,
start at runtime·allg and walk through the alllink field. Don't count
the ones whose status field == Gdead.
Well, it should be the same. Good point.
Would this patch be accepted?
Is runtime.Goroutines() a suitable name for the function?
Seems reasonable to me.