Skip to content

Commit

Permalink
Sync output file before closing. Closes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Dec 3, 2020
1 parent ede1111 commit ea27fd5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ func ConvertFile( // nolint: golint
}
defer inFile.Close() // nolint: gosec

return Convert(inFile, outFile, cidr, ipRange, intRange)
err = Convert(inFile, outFile, cidr, ipRange, intRange)
if err != nil {
return err
}
err = outFile.Sync()
if err != nil {
return errors.Wrapf(err, "error syncing file (%s)", outputFile)
}
return nil
}

// Convert writes the MaxMind GeoIP2 or GeoLite2 CSV in the `input` io.Reader
Expand Down

0 comments on commit ea27fd5

Please sign in to comment.