I have a problem whith this function:
func execute(query Query) (goreq.Response, error) {
res, err := goreq.Request{
Uri: "http://path/to/host",
QueryString: query,
Accept: "application/json",
UserAgent: "XXXGoClient/1.0",
Timeout: 2000 * time.Millisecond,
Compression: goreq.Gzip(),
//ShowDebug: true,
}.Do()
return *res, err
}
i am getting panic: runtime error: invalid memory address or nil pointer dereference
when a error in http request ocurrs.
I know that i would check for something like this:
if err != nil {
// do somthing here
}
but i dont know what i must to do, for example this:
if err != nil {
return
}
i get ./main.go:113: not enough arguments to return