Minimal version selection gives the top-level module in the build additional control, allowing it to exclude specific module versions or replace others with different code, but those exclusions and replacements only apply when found in the top-level module, not when the module is a dependency in a larger build.
A module author is therefore in complete control of that module‘s build when it is the main program being built, but not in complete control of other users’ builds that depend on the module. I believe this distinction will make this proposal scale to much larger, more distributed code bases than the Bundler/Cargo/Dep approach.
replace allows the top-level module control over the exact version used for a dependency
Replace only works for the top-level go.mod. From the proposal doc (link):Minimal version selection gives the top-level module in the build additional control, allowing it to exclude specific module versions or replace others with different code, but those exclusions and replacements only apply when found in the top-level module, not when the module is a dependency in a larger build.A module author is therefore in complete control of that module‘s build when it is the main program being built, but not in complete control of other users’ builds that depend on the module. I believe this distinction will make this proposal scale to much larger, more distributed code bases than the Bundler/Cargo/Dep approach.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/127983cb-cbea-437d-9d54-2d1c2d729523%40googlegroups.com.
On Fri, 7 Feb 2020 at 19:47, <kuznets...@gmail.com> wrote:
On Friday, February 7, 2020 at 10:35:37 PM UTC+3, Jason Phillips wrote:Replace only works for the top-level go.mod. From the proposal doc (link):Minimal version selection gives the top-level module in the build additional control, allowing it to exclude specific module versions or replace others with different code, but those exclusions and replacements only apply when found in the top-level module, not when the module is a dependency in a larger build.A module author is therefore in complete control of that module‘s build when it is the main program being built, but not in complete control of other users’ builds that depend on the module. I believe this distinction will make this proposal scale to much larger, more distributed code bases than the Bundler/Cargo/Dep approach.Thank you for explaining. Looks like bad by design, since I can not create patched libraries. Like mine: https://gitlab.com/axet/libtorrentIf you want to provide a library that's not a hard fork, just a patched version, you can always use the original module name. Any users would need to add a replace directive to use it.There's nothing stopping you creating a forked version of that library - just change import statements appropriately.There's a very good reason for ignoring replace statements in dependencies - it keeps Go module dependency resolution from being NP-complete and is a key enabler for Go's high fidelity builds. See this link for more background: https://research.swtch.com/vgo-mvs.