Skip to content

Commit

Permalink
Fix creation of new database file
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrafrancyz committed Dec 15, 2017
1 parent f9a6fbd commit 2d5b89e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions backend/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@ func NewFile(slugLength int, path string) (*File, error) {
}

if _, err := os.Stat(backend.file); os.IsNotExist(err) {
file, err := os.Create(backend.file)
if err != nil {
return nil, err
}
file.Close()
backend.dirty = true
backend.cache = &sync.Map{}
if err = backend.save(); err != nil {
return nil, err
}
backend.cache = &sync.Map{}
} else {
if err = backend.load(); err != nil {
return nil, err
Expand Down

0 comments on commit 2d5b89e

Please sign in to comment.