|
|
@ -3,6 +3,7 @@ package main
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"encoding/json"
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
|
|
|
|
"log"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -172,6 +173,9 @@ func loadJSON(path string, obj interface{}) error {
|
|
|
|
file = []byte("{}")
|
|
|
|
file = []byte("{}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err = json.Unmarshal(file, &obj)
|
|
|
|
err = json.Unmarshal(file, &obj)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Printf("ERROR: Failed to read \"%s\": %s", path, err)
|
|
|
|
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -181,5 +185,8 @@ func storeJSON(path string, obj interface{}) error {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err = ioutil.WriteFile(path, data, 0644)
|
|
|
|
err = ioutil.WriteFile(path, data, 0644)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Printf("ERROR: Failed to write to \"%s\": %s", path, err)
|
|
|
|
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|