From 906639ad7eb92e9d631599f78979908930e59c84 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Wed, 17 Jan 2024 14:54:30 +0000 Subject: [chore] update viper version (#2539) * update viper version * removes our last uses of the slice package * fix tests --- internal/processing/admin/actions.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'internal/processing/admin') diff --git a/internal/processing/admin/actions.go b/internal/processing/admin/actions.go index b85f05065..0c959b1c5 100644 --- a/internal/processing/admin/actions.go +++ b/internal/processing/admin/actions.go @@ -19,6 +19,7 @@ package admin import ( "context" + "slices" "sync" "time" @@ -26,7 +27,6 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/state" - "golang.org/x/exp/slices" ) func errActionConflict(action *gtsmodel.AdminAction) gtserror.WithCode { @@ -140,8 +140,16 @@ func (a *Actions) GetRunning() []*gtsmodel.AdminAction { // Order by ID descending (creation date). slices.SortFunc( running, - func(a *gtsmodel.AdminAction, b *gtsmodel.AdminAction) bool { - return a.ID > b.ID + func(a *gtsmodel.AdminAction, b *gtsmodel.AdminAction) int { + const k = -1 + switch { + case a.ID > b.ID: + return +k + case a.ID < b.ID: + return -k + default: + return 0 + } }, ) -- cgit v1.2.3