jjzjj

go - 有人可以解释这个使用 channel 的 Go 代码块吗?我不明白它是如何一次执行 500 个 Action 的

我在查找有关如何有效执行大量HTTP请求的知识时,遇到了这个答案:https://stackoverflow.com/a/23319730/749851使用此代码:packagemainimport("flag""fmt""log""net/http""runtime""time")var(reqsintmaxint)funcinit(){flag.IntVar(&reqs,"reqs",1000000,"Totalrequests")flag.IntVar(&max,"concurrent",200,"Maximumconcurrentrequests")}typeResponses