Skip to content

Commit

Permalink
go mod could return latest if the full version isn't provided
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincobain2000 committed Nov 14, 2023
1 parent f2c3b28 commit 67a6fba
Showing 1 changed file with 6 additions and 1 deletion.
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 modVersion
}
if version == "latest" || version == "dev-latest" {
groupedVersions := gb.ListRemoteVersions(false) // donot print
Expand Down

0 comments on commit 67a6fba

Please sign in to comment.