From: Bryan C. Mills Date: Fri, 10 May 2019 19:34:17 +0000 (-0400) Subject: cmd/go/internal/modfetch/codehost: ignore incomplete semver tags in RecentTag X-Git-Tag: go1.13beta1~321 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8d212c3ac3bacdf8d135e94d1e0a0c3cfba6e13a;p=gostls13.git cmd/go/internal/modfetch/codehost: ignore incomplete semver tags in RecentTag Fixes #31965 Change-Id: I2126903196b630c0bee2c022be1a818e0856ce3b Reviewed-on: https://go-review.googlesource.com/c/go/+/176539 Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot Reviewed-by: Jay Conrod --- diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go index 55627cb72a..272eadcb23 100644 --- a/src/cmd/go/internal/modfetch/codehost/git.go +++ b/src/cmd/go/internal/modfetch/codehost/git.go @@ -678,7 +678,8 @@ func (r *gitRepo) RecentTag(rev, prefix string) (tag string, err error) { } semtag := line[len(prefix):] - if semver.IsValid(semtag) { + // Consider only tags that are valid and complete (not just major.minor prefixes). + if c := semver.Canonical(semtag); c != "" && strings.HasPrefix(semtag, c) { highest = semver.Max(highest, semtag) } }