Close file after exporting JSON

Resolves issue #30
This commit is contained in:
Brian Buller 2019-02-18 09:03:43 -06:00
parent 433c8111ba
commit 8c302bd236
2 changed files with 3 additions and 3 deletions

View File

@ -668,17 +668,17 @@ func genJSONString(b *bolt.Bucket) string {
return ret
}
var f *os.File
func logToFile(s string) error {
return writeToFile("bolt-log", s+"\n", os.O_RDWR|os.O_APPEND)
}
func writeToFile(fn, s string, mode int) error {
var f *os.File
var err error
if f == nil {
f, err = os.OpenFile(fn, mode, 0660)
}
defer f.Close()
if err != nil {
return err
}

View File

@ -12,7 +12,7 @@ import (
)
var ProgramName = "boltbrowser"
var VersionNum = 1.1
var VersionNum = 1.2
var databaseFiles []string
var db *bolt.DB