Skip to content

Commit

Permalink
style(cmd): remove useless filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Jguer committed Jul 26, 2020
1 parent 37372c8 commit 520dd58
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,22 @@ func handleVersion() {
}

func lastBuildTime(alpmHandle *alpm.Handle) time.Time {
pkgs, _, _, _, err := query.FilterPackages(alpmHandle)
dbList, err := alpmHandle.SyncDBs()
if err != nil {
return time.Now()
}

var lastTime time.Time
for _, pkg := range pkgs {
thisTime := pkg.BuildDate()
if thisTime.After(lastTime) {
lastTime = thisTime
}
}
_ = dbList.ForEach(func(db alpm.DB) error {
_ = db.PkgCache().ForEach(func(pkg alpm.Package) error {
thisTime := pkg.BuildDate()
if thisTime.After(lastTime) {
lastTime = thisTime
}
return nil
})
return nil
})

return lastTime
}
Expand Down

0 comments on commit 520dd58

Please sign in to comment.