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

Proposal: honor replace directives from imported modules in go.mod #39358

Closed
enuoCM opened this issue Jun 2, 2020 · 4 comments
Closed

Proposal: honor replace directives from imported modules in go.mod #39358

enuoCM opened this issue Jun 2, 2020 · 4 comments
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@enuoCM
Copy link

enuoCM commented Jun 2, 2020

gomod has following restriction:

exclude and replace directives only operate on the current (“main”) module. exclude and replace directives in modules other than the main module are ignored when building the main module. The replace and exclude statements, therefore, allow the main module complete control over its own build, without also being subject to complete control by dependencies.

This make it's hard and unreliable import other modules which have replace. For example, if the “main” module forgets to set related replace of other modules, bugs may happen.

In fact, even the replace is not ignored in modules, the "main" module can still complete control all dependencies by it's own replace. So it's better to not ignore replace directive of other modules.

More info please refer to #39310

@enuoCM enuoCM changed the title Propose: go.mode do not ignore replace directive of other modules Propose: go.mode does not ignore replace directive of other modules Jun 2, 2020
@seankhliao
Copy link
Member

this goes against the design goals of go's version selection algorithm https://research.swtch.com/vgo-mvs

@enuoCM
Copy link
Author

enuoCM commented Jun 3, 2020

That's why this should be a new feature.
Is it just difficult to or can it not completely implement non-local replace?
At least for some kinds of replace, such as relative filesystem in other modules, forked dependency(which should be not conflicting usually), which should be not that difficult.
And at the very least,there should be some warnings if it ignores some non-local replace.

@toothrot
Copy link
Contributor

toothrot commented Jun 8, 2020

Thanks for filing @enuoCM. @rsc has an excellent post describing why this is a difficult problem, and why Go made the decision to explicitly disallow this: https://research.swtch.com/vgo-mvs#replacing_modules

If you do intend on writing a proposal for this, it would need to address the concerns outlined in the design. One such concern is conflict resolution.

Previously #38665, #37261, #36205 (and many others).

@toothrot toothrot changed the title Propose: go.mode does not ignore replace directive of other modules Proposal: honor replace directives from imported modules in go.mod Jun 12, 2020
@gopherbot gopherbot added this to the Proposal milestone Jun 12, 2020
@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 19, 2020
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Proposal WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants