summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2016-02-02 16:13:20 +0100
committerVictor Häggqvist <[email protected]>2016-02-02 16:13:20 +0100
commitd41c5802439d8dcef883ddd7c08282ac2f1dbe5d (patch)
treeed39b6c0ab9f7f4812e57d13db487de095f52266
parentfe381ee41aab312110413150f00e5d617d177ffe (diff)
handle no db file
-rw-r--r--goboom.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/goboom.go b/goboom.go
index b8050c4..ac5e84f 100644
--- a/goboom.go
+++ b/goboom.go
@@ -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 {