We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3ece34b commit f7e48dbCopy full SHA for f7e48db
main.go
@@ -18,11 +18,12 @@ func getStorageDirectory() string {
18
19
func ensureDirectory() string {
20
path := getStorageDirectory()
21
+ os.MkdirAll(path, os.ModePerm)
22
return path
23
}
24
25
func list() {
- path := getStorageDirectory()
26
+ path := ensureDirectory()
27
files, err := ioutil.ReadDir(path)
28
if err != nil {
29
log.Fatal(err)
@@ -51,7 +52,7 @@ func set(key, value string) {
51
52
53
54
func get(key string) {
- keyFile := filepath.Join(getStorageDirectory(), key)
55
+ keyFile := filepath.Join(ensureDirectory(), key)
56
f, err := os.Open(keyFile)
57
58
0 commit comments