Skip to content

Commit

Permalink
improve error when symlink cannot be accessed during walk
Browse files Browse the repository at this point in the history
  • Loading branch information
pivotal-david-osullivan committed Nov 18, 2024
1 parent da0dc94 commit 4de4bf7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sherpa/file_listing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4de4bf7

Please sign in to comment.