In goroutines, we need to create a error channel and bubble errors outwards this way. We don't have proper handling of StartWithDebug goroutine
ex:
errCh := make(chan error)
go func() {
if err := doWork(); err != nil {
errCh <- err
return
}
errCh <- nil
}()
if err := <-errCh; err != nil {
// handle error
}