http的代码,超时以后,会在defer的部分报空指针,不知道哪里有问题了
client := &http.Client{
Timeout: 1 * time.Second,
}
response, errr := client.Do(request)
defer response.Body.Close()
if errr != nil {
dlog.Errorf("format of data is wrong||input=%+v||error=%+v\n", input, errj)
return -1, errr
}
更多评论
```go
response, errr := client.Do(request)
if errr != nil {
dlog.Errorf("format of data is wrong||input=%+v||error=%+v\n", input, errj)
return -1, errr
}
defer response.Body.Close()
``
#1
```go
response, errr := client.Do(request)
if errr != nil {
dlog.Errorf("format of data is wrong||input=%+v||error=%+v\n", input, errj)
return -1, errr
}
defer response.Body.Close()
```
#2