| 152 | } |
| 153 | |
| 154 | func (u *updateCmd) updateProjectRepos(nameVersions []string) error { |
| 155 | if len(nameVersions) == 0 { |
| 156 | return fmt.Errorf("no ports specified to update") |
| 157 | } |
| 158 | |
| 159 | // Use visited map to prevent infinite recursion in case of circular dependencies. |
| 160 | visited := make(map[string]bool) |
| 161 | |
| 162 | for _, nameVersion := range nameVersions { |
| 163 | nameVersion = strings.ReplaceAll(nameVersion, "`", "") |
| 164 | if err := u.updatePortRepo(nameVersion, visited); err != nil { |
| 165 | return err |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | return nil |
| 170 | } |
| 171 | |
| 172 | func (u *updateCmd) updatePortRepo(nameVersion string, visited map[string]bool) error { |
| 173 | // Check for circular dependencies. |