Skip to content

Commit

Permalink
suggestions from pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mafredri committed Nov 13, 2024
1 parent ad8fe14 commit ee63bee
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,10 @@ func (optSet *OptionSet) SetDefaults() error {
groupByValue[opt.Value] = append(groupByValue[opt.Value], opt)
}

// Sorts by value source, then a default value being set.
sortOptionByValueSourcePriorityOrDefault := func(a, b *Option) int {
if a.ValueSource != b.ValueSource {
for _, vs := range valueSourcePriority {
if a.ValueSource == vs {
return -1
}
if b.ValueSource == vs {
return 1
}
}
return slices.Index(valueSourcePriority, a.ValueSource) - slices.Index(valueSourcePriority, b.ValueSource)
}
if a.Default != b.Default {
if a.Default == "" {
Expand Down

0 comments on commit ee63bee

Please # to comment.