Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

301 302 go func(){}() error #149

Open
luohailong opened this issue Apr 26, 2018 · 0 comments
Open

301 302 go func(){}() error #149

luohailong opened this issue Apr 26, 2018 · 0 comments

Comments

@luohailong
Copy link

func main() {
s := []string{"http://www.120ask.com", "http://www.120ask.com/question/72742256.htm"}
for _, uri := range s {
//go curl(uri) // BUG: keyword go Error redirecting. MaxRedirects reached
curl(uri) // right
}
time.Sleep(10 * time.Second)
}
func curl(uri string) {
goreq.SetConnectTimeout(60 * time.Second)
res, err := goreq.Request{
Uri: uri,
Timeout: 60 * time.Second,
}.Do()
if err != nil {
log.Println("request err", err, res)
return
}
_, err = res.Body.ToString()
if res.Body != nil {
res.Body.Close()
}
log.Println(res.StatusCode, err)
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant