File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import (
10
10
11
11
//nolint:gocyclo
12
12
func ExtractErrors (pkg * packages.Package , astCache * astcache.Cache ) []packages.Error {
13
- errors := extractErrorsImpl (pkg )
13
+ errors := extractErrorsImpl (pkg , map [ * packages. Package ] bool {} )
14
14
if len (errors ) == 0 {
15
15
return errors
16
16
}
@@ -48,7 +48,12 @@ func ExtractErrors(pkg *packages.Package, astCache *astcache.Cache) []packages.E
48
48
return uniqErrors
49
49
}
50
50
51
- func extractErrorsImpl (pkg * packages.Package ) []packages.Error {
51
+ func extractErrorsImpl (pkg * packages.Package , seenPackages map [* packages.Package ]bool ) []packages.Error {
52
+ if seenPackages [pkg ] {
53
+ return nil
54
+ }
55
+ seenPackages [pkg ] = true
56
+
52
57
if ! pkg .IllTyped { // otherwise it may take hours to traverse all deps many times
53
58
return nil
54
59
}
@@ -59,7 +64,7 @@ func extractErrorsImpl(pkg *packages.Package) []packages.Error {
59
64
60
65
var errors []packages.Error
61
66
for _ , iPkg := range pkg .Imports {
62
- iPkgErrors := extractErrorsImpl (iPkg )
67
+ iPkgErrors := extractErrorsImpl (iPkg , seenPackages )
63
68
if iPkgErrors != nil {
64
69
errors = append (errors , iPkgErrors ... )
65
70
}
You can’t perform that action at this time.
0 commit comments