On Fri, Jul 29, 2016 at 2:01 AM, wrote:
> Thanks James, are there any golang tools which could have caught this
> issue. I know go vet didnt.
Caught the issue of using the first odd pattern for closing the response
Body? There's no tool that can detect general logic errors in your
program, but
Thanks James, are there any golang tools which could have caught this
issue. I know go vet didnt.
On Thursday, July 28, 2016 at 1:36:04 PM UTC-7, James Bardin wrote:
>
>
>
> On Thursday, July 28, 2016 at 2:34:24 PM UTC-4, krma...@gmail.com wrote:
>>
>> WHere is this documented in "On error, any
On Thursday, July 28, 2016 at 2:34:24 PM UTC-4, krma...@gmail.com wrote:
>
> WHere is this documented in "On error, any Response can be ignored. A
> non-nil Response with a non-nil error only occurs when CheckRedirect fails,
> and even then the returned Response.Body is already closed"
>
> I am
WHere is this documented in "On error, any Response can be ignored. A
non-nil Response with a non-nil error only occurs when CheckRedirect fails,
and even then the returned Response.Body is already closed"
I am interested in looking at it. I didnt find it
here https://golang.org/pkg/net/http/
On Thu, Jul 28, 2016 at 11:08 AM, Ian Davis wrote:
> Great. Very clear.
>
> To those looking for this: it's a new comment added after 1.6.2
>
Thanks, forgot I was on master.
Yes, this was implied by the error handling example in the docs, but now is
much more explicit.
--
You received this me
On Thu, Jul 28, 2016, at 03:50 PM, James Bardin wrote:
>
> On Thu, Jul 28, 2016 at 10:39 AM, Ian Davis wrote:
>> Is it? The http package only says:
>>
>> "When err is nil, resp always contains a non-nil resp.Body. Caller
>> should close resp.Body when done reading from it."
>>
>> It doesn't say
On Thu, Jul 28, 2016 at 10:39 AM, Ian Davis wrote:
> Is it? The http package only says:
>
> "When err is nil, resp always contains a non-nil resp.Body. Caller should
> close resp.Body when done reading from it."
>
> It doesn't say anything about the case where err != nil
>
> On error, any Respon
On Thu, Jul 28, 2016, at 03:14 PM, James Bardin wrote:
>
>
> On Thursday, July 28, 2016 at 2:40:38 AM UTC-4,
> krma...@gmail.com wrote:
>> resp, err := http.Get("https://api.ipify.org?format=json";) if resp !=
>> nil { defer resp.Body.Close() }
>>
>
> This is incorrect. There's no guarantee that
On Thursday, July 28, 2016 at 2:40:38 AM UTC-4, krma...@gmail.com wrote:
>
> resp, err := http.Get("https://api.ipify.org?format=json";) if resp != nil
> { defer resp.Body.Close() }
>
>
This is incorrect. There's no guarantee that a non-nil Response contains a
non-nil Body after an error.
re