cmd/go: mod init doesn't handle replacements well #34509
Labels
FrozenDueToAge
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Same behavior in master.
go version devel +78a3734714 Tue Sep 24 21:33:10 2019 +0000 darwin/amd64
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Ran
go mod init
on a repository with aGopkg.toml
/Gopkg.lock
generated bydep
.This Gopkg.toml contains an alternative source for an import, which translates to a
replace
in go.mod.The intention is that code imports a dependency's original path. The
replace
is then used to use an alternative repo that contains an additional feature/bug fix that is waiting to merge upstream.Reproduced here:
https://github.com/aaronbee/replace_repro
What did you expect to see?
After running
go mod init
, go.mod should be valid:In this case the upstream_path is golang.org/x/tools and alternate_repo is github.com/aaronbee/tools
What did you see instead?
go.mod:
Actual go.mod.
This results in build errors because ALT_REVSION is not present in upstream_repo. It is only valid in alternate_repo.
The text was updated successfully, but these errors were encountered: