Skip to content

Commit

Permalink
Sort linters by name
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed May 4, 2020
1 parent 844bb00 commit 8b17c74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/gui/item/linters.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package item

import (
"sort"

"github.com/gdamore/tcell"
"github.com/rivo/tview"

Expand Down Expand Up @@ -50,7 +52,7 @@ func (l *Linters) SetKeybinds(globalKeybind func(event *tcell.EventKey), selectA
}

func (l *Linters) addChildren(node *tview.TreeNode, linters []golangcilint.Linter) {
// TODO: Sort linters by alphabet
sort.SliceStable(linters, func(i, j int) bool { return linters[i].Name() < linters[j].Name() })
for _, linter := range linters {
child := tview.NewTreeNode(linter.Name()).
SetReference(linter).
Expand Down

0 comments on commit 8b17c74

Please sign in to comment.