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: treat pseudo-version 'vX.0.0-00010101000000-000000000000' as equivalent to an empty commit #33370

Open
bcmills opened this issue Jul 30, 2019 · 1 comment
Assignees
Milestone

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented Jul 30, 2019

In CL 153157, I added code so that a module path that has a replace directive resolves to a pseudo-version of the form vX.0.0-00010101000000-000000000000 rather than checking for upstream dependencies.

That unblocks builds, but means that the module graph may indicate a commit that doesn't actually exist. There are use-cases for such a configuration, such as testing against unpublished commits of upstream modules (see #26241 (comment) and #32776), but since the commit does not actually exist, the requirement graph of the resulting module cannot be used without a corresponding replace directive in every downstream consumer.

Since this pseudo-version has an unambiguous and very unique commit hash (all zeroes!), I propose that we special-case it (if unreplaced) and treat it as equivalent to an empty commit.

CC @jayconrod @thepudds @rogpeppe

@bcmills

This comment has been minimized.

Copy link
Member Author

@bcmills bcmills commented Oct 15, 2019

Thinking about this some more, I think using the zero-version was a mistake.

Instead, we shouldn't be writing the require directive out at all: we don't know any valid version to require, and if a downstream consumer requires our module they're better off resolving latest instead.

That seems to support the second case considered in #26344 (comment): this sort of wildcard replace directive effectively means “select the latest version (none), and then select this replacement as if it were a slightly-higher version.”

@bcmills bcmills modified the milestones: Backlog, Go1.15 Oct 24, 2019
@bcmills bcmills self-assigned this Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.