From c1d96f699c4c83b3d0ece5d16bb8a7a3ecf8b201 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Sat, 18 Feb 2023 16:20:55 -0800 Subject: [PATCH] filelist/hookscripts: don't fail if directory not found --- internal/filelist/hookscripts/hookscripts.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/filelist/hookscripts/hookscripts.go b/internal/filelist/hookscripts/hookscripts.go index aef47f8..b0d45dc 100644 --- a/internal/filelist/hookscripts/hookscripts.go +++ b/internal/filelist/hookscripts/hookscripts.go @@ -1,7 +1,6 @@ package hookscripts import ( - "fmt" "log" "os" "path/filepath" @@ -22,12 +21,14 @@ func New(scriptsDir string) *HookScripts { } func (h *HookScripts) List() (*filelist.FileList, error) { + log.Printf("- Including hook scripts from %s", h.scriptsDir) + files := filelist.NewFileList() - log.Println("- Including hook scripts") fileInfo, err := os.ReadDir(h.scriptsDir) if err != nil { - return nil, fmt.Errorf("getHookScripts: unable to read hook script dir: %w", err) + log.Println("-- Unable to find dir, skipping...") + return files, nil } for _, file := range fileInfo { path := filepath.Join(h.scriptsDir, file.Name())