Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Proposal: honor replace directives from imported modules in go.mod #39358
gomod has following restriction:
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
That's why this should be a new feature.
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.