mirror of
https://github.com/niusmallnan/steve.git
synced 2025-06-26 14:41:35 +00:00
Don't use slow strings.Compare
This commit is contained in:
parent
b78a8b03dd
commit
c61e788d6e
@ -3,7 +3,6 @@ package accesscontrol
|
||||
import (
|
||||
"hash"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
v1 "github.com/rancher/wrangler-api/pkg/generated/controllers/rbac/v1"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
@ -166,12 +165,7 @@ func (p *policyRuleIndex) getRoleBindings(subjectName string) []*rbacv1.RoleBind
|
||||
return nil
|
||||
}
|
||||
sort.Slice(result, func(i, j int) bool {
|
||||
if i := strings.Compare(result[i].Namespace, result[j].Namespace); i < 0 {
|
||||
return true
|
||||
} else if i > 0 {
|
||||
return false
|
||||
}
|
||||
return result[i].Name < result[j].Name
|
||||
return string(result[i].UID) < string(result[j].UID)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user