Skip to content

Commit

Permalink
Resolve afx dir symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
babarot committed Apr 23, 2022
1 parent 6199c37 commit d9bcf97
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 d9bcf97

Please sign in to comment.