Skip to content

Commit

Permalink
replace slices pkg with sort
Browse files Browse the repository at this point in the history
  • Loading branch information
ketsiambaku committed Sep 10, 2024
1 parent 966478b commit b43a28f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions internal/common/debug/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package debug
import (
"encoding/json"
"fmt"
"slices"
"sort"
"strings"
"sync"

Expand Down Expand Up @@ -77,14 +77,9 @@ func (ati *activityTrackerImpl) Stats() Activities {
}{Info: a, Count: count})
}
}
slices.SortFunc(
activities,
func(a, b struct {
Info ActivityInfo
Count int64
}) int {
return strings.Compare(strings.ToLower(a.Info.ActivityType), strings.ToLower(b.Info.ActivityType))
})
sort.Slice(activities, func(i, j int) bool {
return strings.Compare(strings.ToLower(activities[i].Info.ActivityType), strings.ToLower(activities[j].Info.ActivityType)) < 0
})
return activities
}

Expand Down

0 comments on commit b43a28f

Please sign in to comment.