Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Reduce number of calculations and iterations
Browse files Browse the repository at this point in the history
How?
By looping just through solution projects and use its index to access 
both each lock project and  solution project.
  • Loading branch information
Alireza Bashiri committed Nov 26, 2017
1 parent 24afc01 commit 7a9180f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cmd/dep/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,19 @@ func (cmd *statusCommand) runOld(ctx *dep.Ctx, args []string, p *dep.Project, sm
lockProjects := p.Lock.Projects()
solutionProjects := solution.Projects()

for _, sp := range solutionProjects {
for _, lp := range lockProjects {
spr, _, _ := gps.VersionComponentStrings(sp.Version())
lpr, _, _ := gps.VersionComponentStrings(lp.Version())
for i := range solutionProjects {
spr, _, _ := gps.VersionComponentStrings(solutionProjects[i].Version())
lpr, _, _ := gps.VersionComponentStrings(lockProjects[i].Version())

if spr != lpr {
oldLockProjects = append(oldLockProjects, lp)
}
if spr != lpr {
oldLockProjects = append(oldLockProjects, lockProjects[i])
}
}

// TODO: Print output
for _, oldLockProject := range oldLockProjects {
ctx.Out.Println(oldLockProject)
}

return nil
}

Expand Down

0 comments on commit 7a9180f

Please sign in to comment.