Skip to content

Commit

Permalink
fix: use a zero for third digit for major release. #105
Browse files Browse the repository at this point in the history
  • Loading branch information
voidint committed Aug 9, 2023
1 parent d17c1e1 commit 9169b03
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,19 @@ func installed() (versions map[string]bool) {
return
}

var go1_21_0 = semver.MustParse("1.21.0") // https://github.com/golang/go/issues/57631

// render 渲染go版本列表
func render(installed map[string]bool, items []*semver.Version, out io.Writer) {
sort.Sort(semver.Collection(items))

for i := range items {
fields := strings.SplitN(items[i].String(), "-", 2)
v := strings.TrimSuffix(strings.TrimSuffix(fields[0], ".0"), ".0")

v := fields[0]
if items[i].LessThan(go1_21_0) {
v = strings.TrimSuffix(strings.TrimSuffix(v, ".0"), ".0")
}
if len(fields) > 1 {
v += fields[1]
}
Expand Down

0 comments on commit 9169b03

Please sign in to comment.