gorequest

How to share one HTTP request instance beween two goroutines?

◇◆丶佛笑我妖孽 提交于 2020-03-28 06:39:31
问题 I have some code that makes 3 requests to fill 3 variables now. Two requests are same. I want to share one http request between two different functions (in real world, these functions are splitted into two different modules). Let me describe the problem what I have based on much simpler example than I have in real world. At the moment, I have the following main function and Post data structure: type Post struct { ID int `json:"id"` Title string `json:"title"` UserID int `json:"userId"`