diff --git a/internal/hyphae/existing_hypha.go b/internal/hyphae/existing_hypha.go index 8b6cf7f..0301137 100644 --- a/internal/hyphae/existing_hypha.go +++ b/internal/hyphae/existing_hypha.go @@ -1,9 +1,10 @@ package hyphae import ( - "github.com/bouncepaw/mycorrhiza/util" "os" "path/filepath" + + "github.com/bouncepaw/mycorrhiza/util" ) // ExistingHypha is not EmptyHypha. *MediaHypha and *TextualHypha implement this interface. diff --git a/internal/hyphae/files.go b/internal/hyphae/files.go index 9be35a2..3c499bf 100644 --- a/internal/hyphae/files.go +++ b/internal/hyphae/files.go @@ -1,11 +1,11 @@ package hyphae import ( - "github.com/bouncepaw/mycorrhiza/internal/mimetype" - "log" "log/slog" "os" "path/filepath" + + "github.com/bouncepaw/mycorrhiza/internal/mimetype" ) // Index finds all hypha files in the full `path` and saves them to the hypha storage. @@ -51,7 +51,7 @@ func Index(path string) { } } } - log.Println("Indexed", Count(), "hyphae") + slog.Info("Indexed hyphae", "n", Count()) } // indexHelper finds all hypha files in the full `path` and sends them to the @@ -60,7 +60,8 @@ func Index(path string) { func indexHelper(path string, nestLevel uint, ch chan ExistingHypha) { nodes, err := os.ReadDir(path) if err != nil { - log.Fatal(err) + slog.Error("Failed to read directory", "path", path, "err", err) + os.Exit(1) } for _, node := range nodes {