This repository was archived by the owner on Sep 9, 2020. It is now read-only.
File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ IMPROVEMENTS:
17
17
18
18
* Log as dependencies are pre-fetched during dep init ([ #1176 ] ( https://github.com/golang/dep/pull/1176 ) ).
19
19
* Make the gps package importable ([ #1349 ] ( https://github.com/golang/dep/pull/1349 ) ).
20
+ * Improve file copy performance by not forcing a file sync (PR #1408 ).
20
21
21
22
# v0.3.2
22
23
Original file line number Diff line number Diff line change @@ -407,8 +407,7 @@ func CopyDir(src, dst string) error {
407
407
// copyFile copies the contents of the file named src to the file named
408
408
// by dst. The file will be created if it does not already exist. If the
409
409
// destination file exists, all its contents will be replaced by the contents
410
- // of the source file. The file mode will be copied from the source and
411
- // the copied data is synced/flushed to stable storage.
410
+ // of the source file. The file mode will be copied from the source.
412
411
func copyFile (src , dst string ) (err error ) {
413
412
if sym , err := IsSymlink (src ); err != nil {
414
413
return errors .Wrap (err , "symlink check failed" )
@@ -442,13 +441,14 @@ func copyFile(src, dst string) (err error) {
442
441
if err != nil {
443
442
return
444
443
}
445
- defer out .Close ()
446
444
447
445
if _ , err = io .Copy (out , in ); err != nil {
446
+ out .Close ()
448
447
return
449
448
}
450
449
451
- if err = out .Sync (); err != nil {
450
+ // Check for write errors on Close
451
+ if err = out .Close (); err != nil {
452
452
return
453
453
}
454
454
You can’t perform that action at this time.
0 commit comments