You can use
io.Copy() which does exactly this.
Copy copies from src to dst until either EOF is reached on src or an error occurs. It returns the number of bytes copied and the first error encountered while copying, if any.
n, err := io.Copy(w, res.Body) // check err
Also note that
Copy() will not return
nil because if it can "copy" everything until
io.EOF, that is not considered an error.