// IgnoreBackgroundGoroutines returns options for goleak.Find // which ignore goroutines created by "go test" and init functions, // like the one from go.opencensus.io/stats/view/worker.go. // // Goroutines that normally get created later when using the apiserver // get created already when calling this function, therefore they // also get ignored. func IgnoreBackgroundGoroutines() []goleak.Option { … } // GoleakCheck sets up leak checking for a test or benchmark. // The check runs as cleanup operation and records an // error when goroutines were leaked. func GoleakCheck(tb testing.TB, opts ...goleak.Option) { … } func goleakFindRetry(opts ...goleak.Option) error { … }