Skip to content

Commit b017c64

Browse files
committed
Exit with error if it can't create the directory metafates#195
1 parent 847c545 commit b017c64

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

where/where.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
package where
22

33
import (
4+
"log"
5+
"os"
6+
"path/filepath"
7+
48
"github.com/metafates/mangal/constant"
59
"github.com/metafates/mangal/filesystem"
610
"github.com/metafates/mangal/key"
711
"github.com/samber/lo"
812
"github.com/spf13/viper"
9-
"os"
10-
"path/filepath"
1113
)
1214

1315
const EnvConfigPath = "MANGAL_CONFIG_PATH"
1416

1517
// mkdir creates a directory and all parent directories if they don't exist
1618
// will return the path of the directory
1719
func mkdir(path string) string {
18-
lo.Must0(filesystem.Api().MkdirAll(path, os.ModePerm))
20+
if filesystem.Api().MkdirAll(path, os.ModePerm) != nil {
21+
log.Fatalf("Error: could not create directory %s", path)
22+
}
1923
return path
2024
}
2125

0 commit comments

Comments
 (0)