How to set timeout for http.Get() requests in Golang?

后端 未结 7 1451
刺人心
刺人心 2020-12-22 16:15

I\'m making a URL fetcher in Go and have a list of URLs to fetch. I send http.Get() requests to each URL and obtain their response.

resp,fetch_e         


        
7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-22 16:38

    You may use https://github.com/franela/goreq which handles timeouts in a fashion and simple way.

提交回复
热议问题