Clean up db.go

pull/11/head
maru 7 months ago
parent 5656fb96d1
commit 36f353b8a6
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D

@ -89,18 +89,16 @@ func Init(username, password, protocol, address, database string) error {
// TODO temp code // TODO temp code
_, err = os.Stat("userdata") _, err = os.Stat("userdata")
if err != nil { if err != nil {
if os.IsNotExist(err) { // not found, do not migrate if !os.IsNotExist(err) { // not found, do not migrate
return nil
} else {
log.Fatalf("failed to stat userdata directory: %s", err) log.Fatalf("failed to stat userdata directory: %s", err)
return err
} }
return nil
} }
entries, err := os.ReadDir("userdata") entries, err := os.ReadDir("userdata")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
return nil
} }
for _, entry := range entries { for _, entry := range entries {
@ -131,7 +129,6 @@ func Init(username, password, protocol, address, database string) error {
err = StoreSystemSaveData(uuid, systemData) err = StoreSystemSaveData(uuid, systemData)
if err != nil { if err != nil {
log.Fatalf("failed to store system save data for %v: %s\n", uuidString, err) log.Fatalf("failed to store system save data for %v: %s\n", uuidString, err)
continue
} }
// delete old system data // delete old system data

Loading…
Cancel
Save