From 24f6128f2136456abc2ce2cb64e7d38cf8a1ccd2 Mon Sep 17 00:00:00 2001 From: Marco Dinis Date: Wed, 2 Oct 2024 14:23:09 +0100 Subject: [PATCH] use strings.Compare --- lib/services/local/user_task_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/services/local/user_task_test.go b/lib/services/local/user_task_test.go index 8ad1b00361d7b..48b1cf1c87c54 100644 --- a/lib/services/local/user_task_test.go +++ b/lib/services/local/user_task_test.go @@ -22,6 +22,7 @@ import ( "context" "fmt" "slices" + "strings" "testing" "time" @@ -208,13 +209,7 @@ func TestListUserTask(t *testing.T) { protocmp.Transform(), } sortUserTasksFn := func(a *usertasksv1.UserTask, b *usertasksv1.UserTask) int { - if a.Metadata.GetName() < b.Metadata.GetName() { - return 1 - } - if a.Metadata.GetName() > b.Metadata.GetName() { - return -1 - } - return 0 + return strings.Compare(a.Metadata.GetName(), b.Metadata.GetName()) } counts := []int{0, 1, 5, 10} for _, count := range counts {