Skip to content

Commit

Permalink
fix: don't skip ".." directory (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqixu committed Jun 27, 2022
1 parent 796a346 commit 1cd0b53
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parser.go
Expand Up @@ -1567,7 +1567,7 @@ func walkWith(excludes map[string]struct{}, parseVendor bool) func(path string,
if f.IsDir() {
if !parseVendor && f.Name() == "vendor" || // ignore "vendor"
f.Name() == "docs" || // exclude docs
len(f.Name()) > 1 && f.Name()[0] == '.' { // exclude all hidden folder
len(f.Name()) > 1 && f.Name()[0] == '.' && f.Name() != ".." { // exclude all hidden folder
return filepath.SkipDir
}

Expand Down
1 change: 1 addition & 0 deletions parser_test.go
Expand Up @@ -3557,6 +3557,7 @@ func TestParser_Skip(t *testing.T) {
assert.NoError(t, parser.Skip("", &mockFS{FileName: "models", IsDirectory: true}))
assert.NoError(t, parser.Skip("", &mockFS{FileName: "admin", IsDirectory: true}))
assert.NoError(t, parser.Skip("", &mockFS{FileName: "release", IsDirectory: true}))
assert.NoError(t, parser.Skip("", &mockFS{FileName: "..", IsDirectory: true}))

parser = New(SetExcludedDirsAndFiles("admin/release,admin/models"))
assert.NoError(t, parser.Skip("admin", &mockFS{IsDirectory: true}))
Expand Down

0 comments on commit 1cd0b53

Please sign in to comment.