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

10
cmd.go
View File

@ -197,18 +197,22 @@ func handleVersion() {
} }
func lastBuildTime(alpmHandle *alpm.Handle) time.Time { func lastBuildTime(alpmHandle *alpm.Handle) time.Time {
pkgs, _, _, _, err := query.FilterPackages(alpmHandle) dbList, err := alpmHandle.SyncDBs()
if err != nil { if err != nil {
return time.Now() return time.Now()
} }
var lastTime time.Time var lastTime time.Time
for _, pkg := range pkgs { _ = dbList.ForEach(func(db alpm.DB) error {
_ = db.PkgCache().ForEach(func(pkg alpm.Package) error {
thisTime := pkg.BuildDate() thisTime := pkg.BuildDate()
if thisTime.After(lastTime) { if thisTime.After(lastTime) {
lastTime = thisTime lastTime = thisTime
} }
} return nil
})
return nil
})
return lastTime return lastTime
} }