We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 898a53c commit d4d07f0Copy full SHA for d4d07f0
1 file changed
config-parser/sorter/sort.go
@@ -33,6 +33,11 @@ type Section struct {
33
// - sort by Name
34
// - if there is a dependency, section is moved after the one it depends on
35
func Sort(sections []Section) error {
36
+ // first sort by name
37
+ sort.SliceStable(sections, func(i, j int) bool {
38
+ return sections[i].Name < sections[j].Name
39
+ })
40
+
41
// first check that all dependencies exist
42
for _, section := range sections {
43
if section.From == "" {
@@ -56,10 +61,6 @@ func Sort(sections []Section) error {
56
61
}
57
62
58
63
59
- // first sort by name
60
- sort.SliceStable(sections, func(i, j int) bool {
- return sections[i].Name < sections[j].Name
- })
64
// then go through list and check for circular dependencies
65
sortByFrom(0, sections)
66
// done
0 commit comments