From 21b0d8dd4bcb8c403b3871ba129cccda1307a1ba Mon Sep 17 00:00:00 2001 From: Luca Stocchi Date: Fri, 1 Jul 2022 14:48:40 +0200 Subject: [PATCH] fix: prevent skipping current folder if only a single file needs to be ignored (#99) Signed-off-by: Luca Stocchi --- go/pkg/apis/recognizer/language_recognizer.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/go/pkg/apis/recognizer/language_recognizer.go b/go/pkg/apis/recognizer/language_recognizer.go index 2fa479e1..5260dfa7 100644 --- a/go/pkg/apis/recognizer/language_recognizer.go +++ b/go/pkg/apis/recognizer/language_recognizer.go @@ -116,7 +116,11 @@ func GetFilePathsFromRoot(root string) ([]string, error) { errWalk := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if errorIgnoreFile == nil && ignoreFile.MatchesPath(path) { - return filepath.SkipDir + if info.IsDir() { + return filepath.SkipDir + } else { + return nil + } } if !info.IsDir() && isFileInRoot(root, path) { files = append([]string{path}, files...)