Re: [go-nuts] ioutil.ReadAll()

2018-02-14 Thread Jakob Borg
On 14 Feb 2018, at 10:50, mrx mailto:patrik@gmail.com>> wrote: resp, err := http.Get("http://example.com/";) if err != nil { // handle error } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) That err returned from ReadAll. I cannot see how that can possibly fail. Yo

Re: [go-nuts] ioutil.ReadAll()

2018-02-13 Thread 'Axel Wagner' via golang-nuts
For example: https://play.golang.org/p/ycoR-jU48J9 The only read error it ignores is io.EOF (which makes complete sense, when you think about it), everything else get passed up. On Tue, Feb 13, 2018 at 9:19 AM, Patrik Iselind wrote: > Hi, > > I have a hard time imagining when https://golang.or

[go-nuts] ioutil.ReadAll()

2018-02-13 Thread Patrik Iselind
Hi, I have a hard time imagining when https://golang.org/pkg/io/ioutil/#ReadAll would produce err != nil. The documentation doesn't tell either. It would help when writing unittests for code that use ioutil.ReadAll(). // Patrik -- You received this message because you are subscribed to the Go