File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11package semver
22
33import (
4+ "cmp"
45 "context"
56 "fmt"
67 "io"
8+ "slices"
79 "sort"
810
911 "github.com/blang/semver/v4"
@@ -283,8 +285,6 @@ func (sv *semverTemplate) generateChannels(semverChannels *bundleVersions) []dec
283285}
284286
285287func (sv * semverTemplate ) linkChannels (unlinkedChannels map [string ]* declcfg.Channel , harvestedVersions * bundleVersions ) []declcfg.Channel {
286- channels := []declcfg.Channel {}
287-
288288 // bundle --> version lookup
289289 bundleVersions := make (map [string ]semver.Version )
290290 for _ , vs := range * harvestedVersions {
@@ -295,6 +295,7 @@ func (sv *semverTemplate) linkChannels(unlinkedChannels map[string]*declcfg.Chan
295295 }
296296 }
297297
298+ channels := make ([]declcfg.Channel , 0 , len (unlinkedChannels ))
298299 for _ , channel := range unlinkedChannels {
299300 entries := & channel .Entries
300301 sort .Slice (* entries , func (i , j int ) bool {
@@ -350,6 +351,10 @@ func (sv *semverTemplate) linkChannels(unlinkedChannels map[string]*declcfg.Chan
350351 channels = append (channels , * channel )
351352 }
352353
354+ slices .SortFunc (channels , func (a , b declcfg.Channel ) int {
355+ return cmp .Compare (a .Name , b .Name )
356+ })
357+
353358 return channels
354359}
355360
You can’t perform that action at this time.
0 commit comments