The problem is that RepositoryService.UploadReleaseAsset doesn't let you pass in a size to complement the io.Reader. The http.NewRequest function (eventually called by the go-github package) can only automatically determine the size of strings.Readers, bytes.Readers, and bytes.Buffers, so if you were using the http library raw, you would have to call NewRequest, set the ContentLength field on the http.Request yourself, and then use the Do method to perform the upload. Since the github library method you're using doesn't let you work this way (set a ContentLength before the request executes) you have a few options:
1. Do as you have been doing, load the file into a byte slice and pass a bytes.Reader, since the ContentLength can be determined automatically by http.NewRequest
2. Use MMap to get the byte slice and then do the rest of #1 (better memory use)
3. Copy the logic in the RepositoryService.UploadReleaseAsset method (and addOptions) into your own function, and then determine the file size yourself to set the ContentLength of the http.Request before the upload
4. Lobby go-github to add a filesize argument to UploadReleaseAsset (or provide some other method of solving this problem)
5. Lobby go to update the logic of http.NewRequest to allow custom io.Reader's to provide the size for content-length. (If accepted, would probably have to wait until after go-1.2 is released.)
6. Lobby github to change the api to allow file uploads without a Content-Length (very unlikely to happen)