aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modfetch/codehost/git.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-05-10 15:34:17 -0400
committerBryan C. Mills <bcmills@google.com>2019-05-13 17:50:58 +0000
commit8d212c3ac3bacdf8d135e94d1e0a0c3cfba6e13a (patch)
treec4b089aa79ceaef12666393d7ea5fce566ac7278 /src/cmd/go/internal/modfetch/codehost/git.go
parent5f320f962bd79120f542315c8317f3469c47cee3 (diff)
downloadgo-8d212c3ac3bacdf8d135e94d1e0a0c3cfba6e13a.tar.gz
go-8d212c3ac3bacdf8d135e94d1e0a0c3cfba6e13a.zip
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 <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modfetch/codehost/git.go')
-rw-r--r--src/cmd/go/internal/modfetch/codehost/git.go3
1 files changed, 2 insertions, 1 deletions
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)
}
}