Replace experimental maps and slices with stdlib

This commit is contained in:
Eng Zer Jun 2024-12-17 18:24:04 +08:00 committed by GitHub
parent 68a8650297
commit aa8eb1af6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 17 deletions

View file

@ -1,10 +1,9 @@
package api
import (
"cmp"
"net/url"
"sort"
"golang.org/x/exp/constraints"
)
const (
@ -357,7 +356,7 @@ func sortByName[T orderedWithName](direction string, results []T) {
})
}
func sortByFunc[T orderedWithName, U constraints.Ordered](direction string, results []T, fn func(int) U) {
func sortByFunc[T orderedWithName, U cmp.Ordered](direction string, results []T, fn func(int) U) {
// Ascending
if direction == ascendantSorting {
sort.Slice(results, func(i, j int) bool {