Standard library / runtime
runtime.NumGoroutine()
Reports the number of goroutines currently existing. Background runtime activity makes exact totals unstable. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func NumGoroutine() intReturn Value
int
Snapshot of the number of existing goroutines.
Working Example
Example Snippetgo
package main
import ( "fmt" "runtime")
func main() { fmt.Println(runtime.NumGoroutine() >= 1) }