Skip to content

Commit

Permalink
Merge pull request #41 from b4b4r07/fix/40
Browse files Browse the repository at this point in the history
Resolve afx dir symlink
  • Loading branch information
b4b4r07 authored Apr 23, 2022
2 parents 6199c37 + d9bcf97 commit 054f74c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,24 @@ func visitYAML(files *[]string) filepath.WalkFunc {
}
}

func resolveSymlink(path string) (string, error) {
fi, err := os.Lstat(path)
if err != nil {
return path, err
}
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
return os.Readlink(path)
}
return path, nil
}

// WalkDir walks given directory path and returns full-path of all yaml files
func WalkDir(path string) ([]string, error) {
var files []string
path, err := resolveSymlink(path)
if err != nil {
return files, err
}
fi, err := os.Stat(path)
if err != nil {
return files, err
Expand Down

0 comments on commit 054f74c

Please sign in to comment.