title: Upload large files to Google Drive via Golang API
body: <p>I'm using the <a href="https://code.google.com/p/google-api-go-client/" rel="nofollow">google-api-go-client</a> to try to upload files to Google Drive. My code looks very similar to the example code in the library:</p>
  
  <pre><code>goFile, err := os.Open(file_to_upload)
  if err != nil {
    log.Fatalf("error opening file: %v", err)
  }
  
  file_meta := &amp;drive.File{Title: filepath.Base(file_to_upload)}
  _, err = service.Files.Insert(file_meta).Media(goFile).Ocr(true).Do()
  if err != nil {
    panic(err)
  }
  </code></pre>
  
  <p>This works fine for most of the files I've tried, however I consistently get a 500 error for a 5.1M file. I think this is probably due to the fact that the file is larger and the other files I've tested are smaller. The largest successful file I've tried is 3.8M.</p>
  
  <p>Looking at the <a href="https://developers.google.com/drive/manage-uploads#multipart" rel="nofollow">Google Files SDK</a>, it seems that I probably want to use a multipart upload. Does anyone have any example Go code that makes a multipart upload to Google Drive? Is it even possible with the alpha api available.</p>