style(cmd): remove useless filtering

This commit is contained in:
jguer 2020-07-27 00:57:52 +02:00
parent 37372c883f
commit 520dd58999
No known key found for this signature in database
GPG key ID: 6D6CC9BEA8556B35

18
cmd.go
View file

@ -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
}