Skip to content

Commit

Permalink
modules: Fix potential infinite loop in module collection
Browse files Browse the repository at this point in the history
Fixes #12407
  • Loading branch information
bep committed Apr 22, 2024
1 parent 4e483f5 commit f40f50e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ func (c *collector) add(owner *moduleAdapter, moduleImport Import) (*moduleAdapt
// This will select the latest release-version (not beta etc.).
versionQuery = "upgrade"
}
if err := c.Get(fmt.Sprintf("%s@%s", modulePath, versionQuery)); err != nil {

// Note that we cannot use c.Get for this, as that may
// trigger a new module collection and potentially create a infinite loop.
if err := c.get(fmt.Sprintf("%s@%s", modulePath, versionQuery)); err != nil {
return nil, err
}
if err := c.loadModules(); err != nil {
Expand Down

0 comments on commit f40f50e

Please sign in to comment.