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

cmd/go: v1.2 module query matches pre-v1.2 versions #31972

Closed
rsc opened this issue May 10, 2019 · 1 comment
Closed

cmd/go: v1.2 module query matches pre-v1.2 versions #31972

rsc opened this issue May 10, 2019 · 1 comment

Comments

@rsc
Copy link
Contributor

rsc commented May 10, 2019

Version queries like @v1.2 are handled by this code in cmd/go/internal/modload/query.go:

// matchSemverPrefix reports whether the shortened semantic version p
// matches the full-width (non-shortened) semantic version v.
func matchSemverPrefix(p, v string) bool {
	return len(v) > len(p) && v[len(p)] == '.' && v[:len(p)] == p
}

matchSemverPrefix("v1.2", "v1.2.0-prerelease") is true but probably should be false, because semver.Compare("v1.2", "v1.2.0-prerelease") < 0.

/cc @jayconrod @bcmills

@rsc rsc added this to the Go1.13 milestone May 10, 2019
@bcmills bcmills self-assigned this May 10, 2019
@gopherbot
Copy link

Change https://golang.org/cl/176898 mentions this issue: cmd/go: do not allow version prefixes to match prereleases of that version

@golang golang locked and limited conversation to collaborators May 13, 2020
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants