File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import (
1010
1111//nolint:gocyclo
1212func ExtractErrors (pkg * packages.Package , astCache * astcache.Cache ) []packages.Error {
13- errors := extractErrorsImpl (pkg )
13+ errors := extractErrorsImpl (pkg , map [ * packages. Package ] bool {} )
1414 if len (errors ) == 0 {
1515 return errors
1616 }
@@ -48,7 +48,12 @@ func ExtractErrors(pkg *packages.Package, astCache *astcache.Cache) []packages.E
4848 return uniqErrors
4949}
5050
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+
5257 if ! pkg .IllTyped { // otherwise it may take hours to traverse all deps many times
5358 return nil
5459 }
@@ -59,7 +64,7 @@ func extractErrorsImpl(pkg *packages.Package) []packages.Error {
5964
6065 var errors []packages.Error
6166 for _ , iPkg := range pkg .Imports {
62- iPkgErrors := extractErrorsImpl (iPkg )
67+ iPkgErrors := extractErrorsImpl (iPkg , seenPackages )
6368 if iPkgErrors != nil {
6469 errors = append (errors , iPkgErrors ... )
6570 }
You can’t perform that action at this time.
0 commit comments