diff options
author | Victor Häggqvist <[email protected]> | 2016-02-02 16:13:20 +0100 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2016-02-02 16:13:20 +0100 |
commit | d41c5802439d8dcef883ddd7c08282ac2f1dbe5d (patch) | |
tree | ed39b6c0ab9f7f4812e57d13db487de095f52266 | |
parent | fe381ee41aab312110413150f00e5d617d177ffe (diff) |
handle no db file
-rw-r--r-- | goboom.go | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -70,6 +70,10 @@ func addIfNotContains(items []string, item string) []string { } func openDB() map[string]int { + if _, err := os.Stat(dbFilePath); err != nil { + return make(map[string]int) + } + list := CmdList{} file, _ := os.Open(dbFilePath) if err := gocsv.UnmarshalFile(file, &list); err != nil { |