Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.21 -> 1.21.0 #157

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmd/gobrew/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ func init() {
versionArg = versionArgSlice[0] + "." + versionArgSlice[1]
}
}
if len(versionArgSlice) == 2 {
majorVersionNum, _ := strconv.Atoi(versionArgSlice[0])
minorVersionNum, _ := strconv.Atoi(versionArgSlice[1])
// Comply with: https://github.com/kevincobain2000/gobrew/issues/156
// Check if the major version is 1 and the minor version is 21 or greater
if majorVersionNum == 1 && minorVersionNum >= 21 {
// Modify the versionArg to include ".0"
versionArg = versionArg + ".0"
}
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion gobrew.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ func (gb *GoBrew) judgeVersion(version string) string {

if version == "mod" {
// get version by reading the mod file of Go
return gb.getModVersion()
modVersion := gb.getModVersion()
// if modVersion is like 1.19, 1.20, 1.21 then appened @latest to it
if strings.Count(modVersion, ".") == 1 {
modVersion = modVersion + "@latest"
}
return gb.judgeVersion(modVersion)
}
if version == "latest" || version == "dev-latest" {
groupedVersions := gb.ListRemoteVersions(false) // donot print
Expand Down
Loading