use Duration for doorOpenTime + lint
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
This commit is contained in:
@@ -217,7 +217,7 @@ func (doobserver *DoorBoyServer) postKeepDoorOpen(w http.ResponseWriter, r *http
|
||||
rs, _ := io.ReadAll(r.Body)
|
||||
parsedTime, err := time.Parse(time.RFC3339, strings.TrimSpace(string(rs)))
|
||||
if err != nil {
|
||||
fmt.Println("Error with parsing time: %v", err)
|
||||
fmt.Printf("Error with parsing time: %v", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
}
|
||||
keepOpenUntil = &parsedTime
|
||||
@@ -229,6 +229,9 @@ func main() {
|
||||
|
||||
var dumpKeys []cardToken
|
||||
savedKeys, err := os.ReadFile("keys.json")
|
||||
if err != nil {
|
||||
log.Fatalf("reading saved keys from keys.json: %v", err)
|
||||
}
|
||||
|
||||
err = json.Unmarshal(savedKeys, &dumpKeys)
|
||||
if err == nil {
|
||||
@@ -268,7 +271,7 @@ func main() {
|
||||
keyLock.Lock()
|
||||
data, err := json.Marshal(keys)
|
||||
if err == nil {
|
||||
os.WriteFile("keys.json", data, 0600)
|
||||
os.WriteFile("keys.json", data, 0o600)
|
||||
log.Println("Saved keys successfully!")
|
||||
}
|
||||
keyLock.Unlock()
|
||||
|
Reference in New Issue
Block a user