Skip to content

Commit

Permalink
Improved the sorting solution by updating to Go 1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed Nov 22, 2024
1 parent 4418296 commit 4bb8bc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions components/Tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package components

import (
"fmt"
"maps"
"slices"
"sort"
"strings"

Expand Down Expand Up @@ -294,11 +296,7 @@ func (tree *Tree) databasesToNodes(children map[string][]string, node *tview.Tre

// Sort the keys and use them to loop over the
// children so they are always in the same order.
sortedKeys := make([]string, 0, len(children))
for key := range children {
sortedKeys = append(sortedKeys, key)
}
sort.Strings(sortedKeys)
sortedKeys := slices.Sorted(maps.Keys(children))

for _, key := range sortedKeys {
values := children[key]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/jorgerojas26/lazysql

go 1.20
go 1.23

require (
github.com/DATA-DOG/go-sqlmock v1.5.2
Expand Down

0 comments on commit 4bb8bc3

Please sign in to comment.