aboutsummaryrefslogtreecommitdiffstats
path: root/file_store.go
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2016-04-24 10:22:33 -0400
committerGrant Ammons <gammons@gmail.com>2016-04-24 10:22:33 -0400
commit63893587cb41a1980318b60bf05fafbf433a24ab (patch)
tree39c93f3a1735ef33d028ab9ef44fc0ac15049208 /file_store.go
parent6bb90375f4efb2f390a61ede0df70eea1ef1f50f (diff)
Organize things a bit better
Diffstat (limited to 'file_store.go')
-rw-r--r--file_store.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/file_store.go b/file_store.go
deleted file mode 100644
index 3f71ba2..0000000
--- a/file_store.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package todolist
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "os"
- "os/user"
-)
-
-type FileStore struct {
- FileLocation string
- Data []Todo
-}
-
-func NewFileStore() *FileStore {
- usr, _ := user.Current()
- return &FileStore{FileLocation: usr.HomeDir + "/.todos.json"}
-}
-
-func (f *FileStore) Load() {
- data, err := ioutil.ReadFile(f.FileLocation)
- if err != nil {
- fmt.Println("Error reading file", err)
- os.Exit(1)
- }
-
- jerr := json.Unmarshal(data, &f.Data)
- if jerr != nil {
- fmt.Println("Error reading json data", jerr)
- os.Exit(1)
- }
-
-}