commit c0724757978d0404c6bb39e7bc8d29f5da803059 from: Dustin Sallings date: Sun Nov 02 03:35:13 2014 UTC Do proper error handling in the example commit - f304ad58f42e1bf23940e6769b975399e8ee2538 commit + c0724757978d0404c6bb39e7bc8d29f5da803059 blob - 7fffbc4fb34867a2ff0ef44dbfb57997fa831ca7 blob + 9f2baf575cfb23d41b69a848ffeda6fa6aa48237 --- examples/client/exampleclient.go +++ examples/client/exampleclient.go @@ -47,17 +47,20 @@ func main() { n, id, r, err := c.Head(strconv.FormatInt(g.High-1, 10)) maybefatal("getting head", err) log.Printf("msg %d has id %v and the following headers", n, id) - io.Copy(os.Stdout, r) + _, err = io.Copy(os.Stdout, r) + maybefatal("reading head", err) n, id, r, err = c.Body(strconv.FormatInt(n, 10)) maybefatal("getting body", err) log.Printf("Body of message %v", id) io.Copy(os.Stdout, r) + maybefatal("reading body", err) n, id, r, err = c.Article(strconv.FormatInt(n, 10)) maybefatal("getting the whole thing", err) log.Printf("Full message %v", id) io.Copy(os.Stdout, r) + maybefatal("reading the full message", err) err = c.Post(strings.NewReader(examplepost)) maybefatal("posting", err)