我正在尝试并行进行 http 查询,然后等待所有人完成:
g1, _ := go http.Get('http://example.com/1')
g2, _ := go http.Get('http://example.com/2')
res1 := g1.wait() or { panic(err) }
res2 := g2.wait() or { panic(err) }
data1 := json.decode(ApiResult, res1.text) or { panic(err) }
data2 := json.decode(ApiResult, res2.text) or { panic(err) }
我收到以下错误:
src/main.go:159:11: syntax error: unexpected go, expecting expression