Skip to content

Commit 47291a8

Browse files
committed
feat: skip vendor dir
1 parent a0e6cce commit 47291a8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lang/golang/parser/parser.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ func newGoParser(name string, homePageDir string, opts Options) *GoParser {
100100
func (p *GoParser) collectGoMods(startDir string) error {
101101
var workFiles []string
102102
err := filepath.Walk(startDir, func(path string, info fs.FileInfo, err error) error {
103+
// skip vendor
104+
if info.IsDir() && info.Name() == "vendor" {
105+
return filepath.SkipDir
106+
}
103107
if err != nil || !strings.HasSuffix(path, "go.work") {
104108
return nil
105109
}
@@ -125,6 +129,9 @@ func (p *GoParser) collectGoMods(startDir string) error {
125129
deps := map[string]string{}
126130
var cgoPkgs map[string]bool
127131
err = filepath.Walk(startDir, func(path string, info fs.FileInfo, err error) error {
132+
if info.IsDir() && info.Name() == "vendor" {
133+
return filepath.SkipDir
134+
}
128135
if err != nil || !strings.HasSuffix(path, "go.mod") {
129136
return nil
130137
}

0 commit comments

Comments
 (0)