Skip to content

Commit

Permalink
Merge pull request #157 from kevincobain2000/feature/version-1.21.0
Browse files Browse the repository at this point in the history
1.21 -> 1.21.0
  • Loading branch information
kevincobain2000 committed Nov 14, 2023
2 parents f83b038 + 97a39e2 commit 5295fd4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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

0 comments on commit 5295fd4

Please sign in to comment.