Fix readdir regression while merging (#2061)

Ref https://github.com/roboll/helmfile/pull/2058#issuecomment-1019439394
This commit is contained in:
Yusuke Kuoka 2022-01-23 20:37:46 +09:00 committed by GitHub
parent 1d70130ab9
commit 061644c5d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -133,13 +133,16 @@ func (c *Context) ReadFile(filename string) (string, error) {
} }
func (c *Context) ReadDir(path string) ([]string, error) { func (c *Context) ReadDir(path string) ([]string, error) {
if !filepath.IsAbs(path) { var contextPath string
path = filepath.Join(c.basePath, path) if filepath.IsAbs(path) {
contextPath = path
} else {
contextPath = filepath.Join(c.basePath, path)
} }
entries, err := os.ReadDir(path) entries, err := os.ReadDir(contextPath)
if err != nil { if err != nil {
return nil, fmt.Errorf("ReadDir %q: %w", path, err) return nil, fmt.Errorf("ReadDir %q: %w", contextPath, err)
} }
var filenames []string var filenames []string