release: simplify hook sorting

Signed-off-by: Raushan Kumar <raus7n@gmail.com>
pull/32386/head
Raushan Kumar 3 months ago
parent 20a1ca2345
commit db8da0a937

@ -144,16 +144,15 @@ func sortManifestsByKind(manifests []Manifest, ordering KindSortOrder) []Manifes
func sortHooksByKind(hooks []*release.Hook, ordering KindSortOrder) []*release.Hook {
orderMap := buildKindOrderMap(ordering)
h := hooks
sort.SliceStable(h, func(i, j int) bool {
sort.SliceStable(hooks, func(i, j int) bool {
return lessByKind(
h[i].Kind,
h[j].Kind,
hooks[i].Kind,
hooks[j].Kind,
orderMap,
)
})
return h
return hooks
}
func lessByKind(

@ -145,16 +145,15 @@ func sortManifestsByKind(manifests []Manifest, ordering KindSortOrder) []Manifes
func sortHooksByKind(hooks []*release.Hook, ordering KindSortOrder) []*release.Hook {
orderMap := buildKindOrderMap(ordering)
h := hooks
sort.SliceStable(h, func(i, j int) bool {
sort.SliceStable(hooks, func(i, j int) bool {
return lessByKind(
h[i].Kind,
h[j].Kind,
hooks[i].Kind,
hooks[j].Kind,
orderMap,
)
})
return h
return hooks
}
func lessByKind(kindA string, kindB string, ordering map[string]int) bool {

Loading…
Cancel
Save