How can you upload files as a stream in go?
<p>There are a number of tutorials about posting files using <code>http.Request</code> in go, but almost invariably they start like this:</p>

<pre><code>file, err := os.Open(path)
if err != nil {
    return nil, err
}
fileContents, err := ioutil.ReadAll(file)
</code></pre>

<p>Which is to say, you read the entire file into memory, and then convert it into a <code>Buffer</code> and pass that into a request, something like this:</p>

<pre><code>func send(client *http.Client, file *os.File, endpoint string) {
    body := &amp;bytes.Buffer{}
    io.Copy(body, file)
    req, _ := http.NewRequest("POST", endpoint, body)
    resp, _ := client.Do(req)
}
</code></pre>

<p>If you wanted to post a massive file and avoid reading it into memory, but instead steam the file up in chunks... how would you do that?</p>