Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve error when symlink cannot be accessed during walk #382

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading