On Tue, Jan 20, 2015 at 1:42 PM, Aki Balogh wrote:
Makes sense. I should just handle the case if resp.Body == 0 bytes.
That's just up to you. If the lack of the body is an error condition for
you, then handle it. It's perfectly valid for a server to not return an
http body. Here you're also not checking the response.StatusCode to see if
it's really what you want either.

I am leaking goroutines. I've been assuming that they get GC'd
eventually, but it's sloppy code.

Buffering sounds like a good solution. Can you point me in the right
direction of what to read up on?
To be absolutely certain that all download goroutines can complete without
a receiver on articleChan, you would have to make articleChan large enough
to hold all responses. (http://golang.org/doc/effective_go.html#channels)

     articleChan := make(chan string, len(urlsSlice))

You're also not checking the error from reading the resp.Body. Again,
probably not the issue here, but your response may not be what you think it

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 11 of 15 | next ›
Discussion Overview
groupgolang-nuts @
postedJan 19, '15 at 4:38p
activeJan 21, '15 at 3:59p



site design / logo © 2022 Grokbase