Skip to content

Commit

Permalink
sort config when loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
afflom committed Oct 15, 2022
1 parent ab257d4 commit d92a2ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"sort"

"sigs.k8s.io/yaml"

Expand Down Expand Up @@ -37,6 +38,15 @@ func LoadDataSetConfig(data []byte) (configuration v1alpha1.DataSetConfiguration
if err = dec.Decode(&configuration); err != nil {
return configuration, err
}

// Sort the slices within the DataSetConfiguration and store the file
// in the manifest config of the OCI artifact for later.
sort.Slice(configuration.Collection.Files, func(i, j int) bool {
return configuration.Collection.Files[i].File < configuration.Collection.Files[j].File
})
sort.Slice(configuration.Collection.LinkedCollections, func(i, j int) bool {
return configuration.Collection.LinkedCollections[i] < configuration.Collection.LinkedCollections[j]
})
return configuration, err
}

Expand Down

0 comments on commit d92a2ce

Please sign in to comment.