Is it possible to fail when executing go f
?
Since the keyword go has no return value, how to determine whether a goroutine is successfully started during high concurrency?
For Example:
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var wg = &sync.WaitGroup{}
go func() { // How do I know if there is any failure here?
wg.Add(1)
fmt.Println("halo world")
wg.Done()
}()
time.Sleep(time.Nanosecond)
wg.Wait()
}