Skip to content

Commit 1c7e84b

Browse files
committed
Add more debug, remove deprecations
1 parent b4d3298 commit 1c7e84b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

simple_json_db.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package simple_json_db
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98
"strings"
@@ -48,8 +47,10 @@ func (db *SimpleDB) init() {
4847
}
4948
if db.debugEnabled {
5049
fmt.Println("[SimpleDB] File path set")
50+
fmt.Printf("[SimpleDB] File path is: %s\n", db.filePath)
5151
}
52-
fileContent, err := ioutil.ReadFile(db.filePath)
52+
53+
fileContent, err := os.ReadFile(db.filePath)
5354
if err == nil {
5455
json.Unmarshal(fileContent, &db.data)
5556
}
@@ -63,7 +64,7 @@ func (db *SimpleDB) writeDb() {
6364
fmt.Println("[SimpleDB] Writing database to file")
6465
}
6566
fileContent, _ := json.Marshal(db.data)
66-
ioutil.WriteFile(db.filePath, fileContent, 0644)
67+
os.WriteFile(db.filePath, fileContent, 0644)
6768
db.timeoutRemove()
6869
}
6970

0 commit comments

Comments
 (0)