From db8da0a937da41e0d7c145861dfb0b6ca3a6f2de Mon Sep 17 00:00:00 2001 From: Raushan Kumar Date: Sun, 19 Jul 2026 19:38:53 +0530 Subject: [PATCH] release: simplify hook sorting Signed-off-by: Raushan Kumar --- internal/release/v2/util/kind_sorter.go | 9 ++++----- pkg/release/v1/util/kind_sorter.go | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/internal/release/v2/util/kind_sorter.go b/internal/release/v2/util/kind_sorter.go index 000fbf1b6..c7912f7f9 100644 --- a/internal/release/v2/util/kind_sorter.go +++ b/internal/release/v2/util/kind_sorter.go @@ -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( diff --git a/pkg/release/v1/util/kind_sorter.go b/pkg/release/v1/util/kind_sorter.go index ae8dae76a..427ee22c4 100644 --- a/pkg/release/v1/util/kind_sorter.go +++ b/pkg/release/v1/util/kind_sorter.go @@ -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 {