当前位置:网站首页>golang 等待一组goroutine完成,并带返回值(2)
golang 等待一组goroutine完成,并带返回值(2)
2022-07-27 15:53:00 【gitxuzan_】
// https://github.com/AaronJan/Hunch
ctx := context.Background()
r, err := hunch.All(
ctx,
func(ctx context.Context) (interface{
}, error) {
time.Sleep(300 * time.Millisecond)
return 1, nil
},
func(ctx context.Context) (interface{
}, error) {
time.Sleep(200 * time.Millisecond)
return 2, nil
},
func(ctx context.Context) (interface{
}, error) {
time.Sleep(100 * time.Millisecond)
return 3, nil
},
)
fmt.Println(r, err)
//输出
// [1 2 3] <nil>
边栏推荐
- Redis: configuring AOF does not work
- [Southwest University] information sharing of postgraduate entrance examination and re examination
- Original direct selling MOS tube knl42150 2.8a/1500v applicable photovoltaic inverter can provide samples
- Configuration and basic use of vim
- Wechat applet to make calls
- likeshop外卖点餐系统「100%开源无加密」
- Wechat applet cloud function batch delete multiple data error: errcode: -502005 database collection not exists
- Evaluation index of machine learning (I) -- regression evaluation index
- Yanrong technology was selected as Beijing's "specialized and innovative" in 2022 to lead hybrid cloud file storage
- Wechat applet realizes location map display and introduces map map without navigation
猜你喜欢

I got the P8 "top-level" distributed architecture manual crazy spread on Alibaba intranet

运行loam_velodyne实时建图

How to develop an online Excel spreadsheet system (Part 1)

Compilation and testing of raspberry pie driver code

机器学习之评价指标(一)——回归评价指标

Taishan Office Technology Lecture: word strange paragraph borders

公网域名如何解析到内网IP服务器——快解析域名映射外网访问

面试官:什么是脚手架?为什么需要脚手架?常用的脚手架有哪些?

DDD (Domain Driven Design) layered architecture

The Ministry of industry and information technology re governs data security, and Netease Yidun "privacy compliance" keeps the bottom line of enterprise operation
随机推荐
Application of knowing things and learning | correlation graph analysis in anti cheating business
Machine learning: IOU of concept understanding
【数据库系统概论(王珊)】第5章——数据库完整性
Could not obtain transaction-synchronized Session for current thread
#夏日挑战赛#【FFH】实时聊天室之WebSocket实战
Cow! His secret is to reproduce the paper in 2 hours——
运行loam_velodyne实时建图
工信部再治数据安全,网易易盾“隐私合规”守住企业经营底线
Redis: configuring AOF does not work
数据库超话(一)
Mysql database defines cursor in trigger
[MCU] 2.2 pin function of AT89S52
Compilation and testing of raspberry pie driver code
Soul 1: why is es more suitable for complex condition search than MySQL?
Personal understanding of convolution calculation process of convolution neural network
Initial polymorphism
likeshop外卖点餐系统「100%开源无加密」
WebDriverException( selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executabl
anaconda重新卸载
7月第4周易盾业务风控关注 | 最高法对APP强索个人信息进行规制