From 4de4bf7324dfa5ce77ddb05e9154afd8e1e87020 Mon Sep 17 00:00:00 2001 From: David O'Sullivan Date: Mon, 18 Nov 2024 10:27:05 +0000 Subject: [PATCH] improve error when symlink cannot be accessed during walk --- sherpa/file_listing.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sherpa/file_listing.go b/sherpa/file_listing.go index ba74cad..cafcdf2 100644 --- a/sherpa/file_listing.go +++ b/sherpa/file_listing.go @@ -71,7 +71,7 @@ func NewFileListing(roots ...string) ([]FileEntry, error) { if os.IsNotExist(err) { continue } else if err != nil { - results <- result{err: fmt.Errorf("unable to resolve %s\n%w", root, err)} + results <- result{err: fmt.Errorf("symlink path %s does not exist according to the OS\n%w", root, err)} return } @@ -178,7 +178,7 @@ func isSymlinkToDir(symlink string, f os.FileInfo) (bool, error) { stat, err := os.Stat(path) if err != nil { - return false, fmt.Errorf("unable to stat file %s\n%w", path, err) + return false, fmt.Errorf("unable to stat file - source path contains a symlink that cannot be followed, at %s\n%w", path, err) } return stat.IsDir(), nil