Skip to content

Commit

Permalink
a/b testing... is it really two closes that fixes it?
Browse files Browse the repository at this point in the history
Signed-off-by: Kit Patella <[email protected]>
  • Loading branch information
mkcp committed Oct 1, 2024
1 parent 193254c commit bb4b8b6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/pkg/layout/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ func splitFile(srcPath string, chunkSize int) (err error) {
if err != nil {
return err
}
// defer func(dstFile *os.File) {
// err2 := dstFile.Close()
// err = errors.Join(err, err2)
// }(dstFile)
defer func(dstFile *os.File) {
err2 := dstFile.Close()
err = errors.Join(err, err2)
}(dstFile)

written, copyErr := io.CopyN(dstFile, srcFile, int64(chunkSize))
if copyErr != nil && !errors.Is(copyErr, io.EOF) {
Expand All @@ -67,7 +67,7 @@ func splitFile(srcPath string, chunkSize int) (err error) {
return err
}

// Does inline close fix windows?
// FIXME(mkcp): Does inline close fix windows?
err = dstFile.Close()
if err != nil {
return err
Expand Down

0 comments on commit bb4b8b6

Please sign in to comment.