cmd/go: mod download swallows BitBucket git errors when VCS lookup fails #47311
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputThe OS is Ubuntu 18.04.
What did you do?
go mod download -x
What did you expect to see?
I expected this to download the modules specified in
go.mod
.What did you see instead?
More configuration info
I've also set
git config --global url."git@bitbucket.org:".insteadOf "https://bitbucket.org"
Cause
The underlying problem here is a git problem, not a go problem and I will report it on git, but the way go handles the git failure is very unhelpful.
The git failure happens because a git submodule is mapped using an overlay mount so that
.git
specifies agitdir
which doesn't exist and this submodule directory is the cwd. Under these conditions, any git operation fails, even if it is one that doesn't require you to be in a git repository at the time. For instance, the failure ofgit ls-remote
mentioned in the output above is actually:Note that the same command succeeds if the current working directory is
$HOME
:But, as noted above, this failure is reported by
go mod download
as:This makes it appear as though the
GOPRIVATE
setting is being ignored.The text was updated successfully, but these errors were encountered: