From 07c8c711c7a572ad2185643b137613dbf97b6501 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Sat, 18 Feb 2023 12:23:37 -0800 Subject: [PATCH] filelist/hookfiles: don't error out if dir is not found Just print a message that it wasn't found, instead of sending an error that may stop the entire app. --- internal/filelist/hookfiles/hookfiles.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/filelist/hookfiles/hookfiles.go b/internal/filelist/hookfiles/hookfiles.go index cba574e..c5f6e6c 100644 --- a/internal/filelist/hookfiles/hookfiles.go +++ b/internal/filelist/hookfiles/hookfiles.go @@ -26,12 +26,14 @@ func New(filePath string) *HookFiles { } func (h *HookFiles) List() (*filelist.FileList, error) { - log.Println("- Including files") + log.Printf("- Including file lists from %s", h.filePath) + + files := filelist.NewFileList() fileInfo, err := os.ReadDir(h.filePath) if err != nil { - return nil, fmt.Errorf("getHookFiles: unable to read hook file dir: %w", err) + log.Println("-- Unable to find dir, skipping...") + return files, nil } - files := filelist.NewFileList() for _, file := range fileInfo { path := filepath.Join(h.filePath, file.Name()) f, err := os.Open(path)