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
Assignees
Milestone

Comments

@rsc
Copy link
Contributor

@rsc 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
@rsc rsc added the release-blocker label May 10, 2019
@bcmills bcmills self-assigned this May 10, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented May 13, 2019

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

@gopherbot gopherbot closed this in 9892cd6 May 14, 2019
@thepudds thepudds added the modules label May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.