title: Alternative To ioutil.ReadAll in go?
body: <p>For a program I'm making this function is ran as a goroutine in a for loop depending on how many urls are passed in (no set amount). </p>
  
  <pre><code>func makeRequest(url string, ch chan&lt;- string, errors map[string]error){
    res, err := http.Get(url)
    if err != nil {
      errors[url] = err
      close(ch)
      return
    }
  
    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)
    ch &lt;- string(body)
  }
  </code></pre>
  
  <p>The entire body of the response has to be used so ioutil.ReadAll seemed like the perfect fit but with no restriction on the amount of urls that can be passed in and the nature of ReadAll being that it's all stored in memory it's starting to feel less like the golden ticket. I'm fairly new to Go so if you do decide to answer, if you could give some explanation behind your solution it would be greatly appreciated! </p>