我试图从一个方法返回两个值(结果和错误),但我得到了这个cannot use err (type error) as type goreq.Error in return argument我的代码package componentsimport ( goreq "github.com/franela/goreq" "time")var UserAgent string = "..."func Get(url string) (*goreq.Response, goreq.Error) { goreq.SetConnectTimeout(15 * time.Second) res, err := goreq.Request{ Uri: url, UserAgent: UserAgent, Timeout: 5 * time.Second, }.Do() return res, err}
- 1 回答
- 0 关注
- 2184 浏览
添加回答
举报
0/150
提交
取消