If writeCloser.Close() is defer'ed, it runs after os.Chtimes which (at least on Windows) causes the modification time to be set to "now" rather than the file modification time from Google Drive.
We now explicitly close the file before setting the modification time (or returning from the function in case of error).
If
writeCloser.Close()
is defer'ed, it runs afteros.Chtimes
which (at least on Windows) causes the modification time to be set to "now" rather than the file modification time from Google Drive.We now explicitly close the file before setting the modification time (or returning from the function in case of error).