capver: order TailscaleLatestMajorMinor versions with cmpver

Lexical sort placed v1.100 before v1.98; cmpver compares numerically.
This commit is contained in:
Kristoffer Dalby
2026-06-26 13:16:36 +00:00
parent 622e08f5e6
commit 1867213b69
+4 -2
View File
@@ -5,10 +5,10 @@ package capver
import (
"maps"
"slices"
"sort"
"strings"
"tailscale.com/tailcfg"
"tailscale.com/util/cmpver"
"tailscale.com/util/set"
)
@@ -74,7 +74,9 @@ func TailscaleLatestMajorMinor(n int, stripV bool) []string {
}
majorSl := majors.Slice()
sort.Strings(majorSl)
// cmpver orders versions numerically, so v1.100 sorts after v1.98 rather than
// lexically before it.
slices.SortFunc(majorSl, cmpver.Compare)
if n > len(majorSl) {
return majorSl