File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ type Section struct {
3333// - sort by Name
3434// - if there is a dependency, section is moved after the one it depends on
3535func 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+
3641 // first check that all dependencies exist
3742 for _ , section := range sections {
3843 if section .From == "" {
@@ -56,10 +61,6 @@ func Sort(sections []Section) error {
5661 }
5762 }
5863
59- // first sort by name
60- sort .SliceStable (sections , func (i , j int ) bool {
61- return sections [i ].Name < sections [j ].Name
62- })
6364 // then go through list and check for circular dependencies
6465 sortByFrom (0 , sections )
6566 // done
You can’t perform that action at this time.
0 commit comments