Skip to content

Commit

Permalink
sort modules before listing
Browse files Browse the repository at this point in the history
  • Loading branch information
icholy committed Sep 19, 2022
1 parent 70a536c commit c65b0b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/packages/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"

"golang.org/x/mod/modfile"
Expand Down Expand Up @@ -133,5 +134,8 @@ func Direct(dir string) ([]module.Version, error) {
mods = append(mods, req.Mod)
}
}
sort.Slice(mods, func(i, j int) bool {
return mods[i].Path < mods[j].Path
})
return mods, nil
}

0 comments on commit c65b0b7

Please sign in to comment.