go通道返回给return

package update

func main() {
resultWorkerErr := make(chan error)
defer close(resultWorkerErr)
go func() {
defer cancel()
resultWorkerErr <- b.resultWorker(ctx)
}()

err := b.worker(ctx)
cancel()
if err == nil {
return <-resultWorkerErr
}
return multierror.Append(err, <-resultWorkerErr)
}
posted @ 2024-11-29 12:07  技术颜良  阅读(1)  评论(0编辑  收藏  举报