From 15d91e4661b7b7c2ed1b6c447168975d6b3900a2 Mon Sep 17 00:00:00 2001 From: jguer Date: Thu, 28 Oct 2021 17:41:51 +0200 Subject: [PATCH] fix(search): revert repo query revert. Fixes #1623 --- pkg/query/source.go | 2 +- pkg/query/types.go | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/query/source.go b/pkg/query/source.go index db3c5513..e49089e7 100644 --- a/pkg/query/source.go +++ b/pkg/query/source.go @@ -139,7 +139,7 @@ func queryRepo(pkgInputN []string, dbExecutor db.Executor, sortMode int) repoQue s := repoQuery(dbExecutor.SyncPackages(pkgInputN...)) if sortMode == settings.BottomUp { - s = sort.Reverse(s).(repoQuery) + s.Reverse() } return s diff --git a/pkg/query/types.go b/pkg/query/types.go index a886174e..80073517 100644 --- a/pkg/query/types.go +++ b/pkg/query/types.go @@ -24,12 +24,10 @@ type aurSortable struct { sortMode int } -func (r repoQuery) Len() int { - return len(r) -} - -func (r repoQuery) Swap(i, j int) { - r[i], r[j] = r[j], r[i] +func (r repoQuery) Reverse() { + for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 { + r[i], r[j] = r[j], r[i] + } } func (r repoQuery) Less(i, j int) bool {