Skip to content

Commit

Permalink
Merge pull request #31 from maxmind/greg/sync
Browse files Browse the repository at this point in the history
Sync output file before closing. Closes #30
  • Loading branch information
horgh authored Dec 3, 2020
2 parents ede1111 + ea27fd5 commit 789255e
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 789255e

Please sign in to comment.