You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
B repo fork from the A repo and B repo add some codes that A repo doesn't have.
Try to import B in C with go mod.
go get B
Go will compliant and refuse to import B.
module declares its path as: A
but was required as: B
Because of B fork from A, it is no way to rename all the import paths which relevant to A since it will break the dependency.
And those users of B are painful to import B to their project, since go get refuse to import B, and they have to modify the go.mod by themselves.
For example:
go mod edit -replace A@latest=B@latest
It's like B is a second-class citizen.
Proposal
I propose that go get can handle this scenario by add replace in go.mod and not refuse to import such repo.
Or maybe we can add a new flag go get -r to declare that the user wants to add a replacement explicitly.
Also, currently, go get -u refuse to upgrade B repo even we already add replace in go.mod. Therefore I think go get -u should respect this if this proposal passed.
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
proposal: go get automatically add replace in go.mod
proposal: cmd/go: go get automatically add replace in go.mod
May 21, 2020
Scenario
B
repo fork from theA
repo andB
repo add some codes thatA
repo doesn't have.Try to import
B
inC
with go mod.Go will compliant and refuse to import
B
.Because of
B
fork fromA
, it is no way to rename all the import paths which relevant toA
since it will break the dependency.And those users of
B
are painful to importB
to their project, sincego get
refuse to importB
, and they have to modify thego.mod
by themselves.For example:
It's like
B
is a second-class citizen.Proposal
I propose that
go get
can handle this scenario by addreplace
ingo.mod
and not refuse to import such repo.Or maybe we can add a new flag
go get -r
to declare that the user wants to add a replacement explicitly.Also, currently,
go get -u
refuse to upgradeB
repo even we already addreplace
ingo.mod
. Therefore I thinkgo get -u
should respect this if this proposal passed.The text was updated successfully, but these errors were encountered: