Skip to content

Commit

Permalink
Invert check to decrease steps
Browse files Browse the repository at this point in the history
Signed-off-by: DanWlker <[email protected]>
  • Loading branch information
DanWlker committed Jul 22, 2024
1 parent c0e3392 commit 6bc24a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ func (g YamlConfig) Parse() (*Config, error) {
sort.Slice(sections, func(i, j int) bool {
sectionI, sectionJ := sections[i].Type(), sections[j].Type()

if strings.Compare(sectionI, sectionJ) == 0 && !g.Cfg.NoLexOrder {
return strings.Compare(sections[i].String(), sections[j].String()) < 0
if g.Cfg.NoLexOrder || strings.Compare(sectionI, sectionJ) != 0 {
return defaultOrder[sectionI] < defaultOrder[sectionJ]
}
return defaultOrder[sectionI] < defaultOrder[sectionJ]

return strings.Compare(sections[i].String(), sections[j].String()) < 0
})
}

Expand Down

0 comments on commit 6bc24a0

Please sign in to comment.