We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad8fe14 commit ee63beeCopy full SHA for ee63bee
option.go
@@ -333,16 +333,10 @@ func (optSet *OptionSet) SetDefaults() error {
333
groupByValue[opt.Value] = append(groupByValue[opt.Value], opt)
334
}
335
336
+ // Sorts by value source, then a default value being set.
337
sortOptionByValueSourcePriorityOrDefault := func(a, b *Option) int {
338
if a.ValueSource != b.ValueSource {
- for _, vs := range valueSourcePriority {
339
- if a.ValueSource == vs {
340
- return -1
341
- }
342
- if b.ValueSource == vs {
343
- return 1
344
345
+ return slices.Index(valueSourcePriority, a.ValueSource) - slices.Index(valueSourcePriority, b.ValueSource)
346
347
if a.Default != b.Default {
348
if a.Default == "" {
0 commit comments