Skip to content

Commit

Permalink
skip hidden files when list files with given extension (#10654)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Jun 17, 2024
1 parent abec24b commit ef702f7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/dir/rw_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package dir
import (
"os"
"path/filepath"
"strings"

"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -133,6 +134,9 @@ func ListFiles(dir string, extensions ...string) (paths []string, err error) {
if f.IsDir() && !f.Type().IsRegular() {
continue
}
if strings.HasPrefix(f.Name(), ".") {
continue
}
match := false
if len(extensions) == 0 {
match = true
Expand Down

0 comments on commit ef702f7

Please sign in to comment.