Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make.bash: cannot build toolchain if go.mod recursively exists in some parent directory #33090

Open
dsnet opened this issue Jul 12, 2019 · 4 comments
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dsnet
Copy link
Member

dsnet commented Jul 12, 2019

Using go1.12. That is GOROOT_BOOTSTRAP is set to some Go toolchain with module support.

Steps to reproduce:

$ go mod init github.com/user/project
$ mkdir -p sub/sub/sub && cd sub/sub/sub
$ curl -s -L https://dl.google.com/go/go1.12.7.src.tar.gz | tar -zxf -
$ cd go/src
$ ./make.bash # this fails
Building Go cmd/dist using /usr/local/go.
Building Go toolchain1 using /usr/local/go.
go: warning: "bootstrap/cmd/..." matched no packages
go tool dist: open /tmp/blah/sub/sub/sub/go/pkg/bootstrap/bin/asm: no such file or directory
$ rm ../../../../../go.mod
$ ./make.bash # this succeeds

It seems odd that ./make.bash should care whether a go.mod file exists in any directory above it.

\cc @bcmills

@bcmills
Copy link
Contributor

bcmills commented Jul 12, 2019

The bootstrapping code for go1.12 is not really aware of module mode. Does this occur with a clone of the go repository at head?

@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jul 12, 2019
@dsnet
Copy link
Member Author

dsnet commented Jul 12, 2019

Nope. Replace curl -s -L https://dl.google.com/go/go1.12.7.src.tar.gz | tar -zxf - with git clone https://go.googlesource.com/go and the problem goes away.

@bcmills
Copy link
Contributor

bcmills commented Jul 12, 2019

Ok. In that case, I don't think we need to backport a fix. (I did a bunch of work to make the go repo itself work in module mode at the start of the 1.13 cycle, so it's not surprising that it doesn't work well in 1.12.7.) I'm going to close this issue as fixed, but please do reopen if I've missed an important use-case that it impacts.

@bcmills bcmills closed this as completed Jul 12, 2019
@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 12, 2019
@dsnet
Copy link
Member Author

dsnet commented Jul 19, 2019

Re-opening. This is still an issue at tip if the go.mod file is sufficiently complicated (e.g., has a require statement).

Repro steps:

go mod init github.com/user/project
echo "require github.com/golang/protobuf v1.2.1-0.20190620192300-1ee46dfd80dd" >> go.mod
mkdir -p sub/sub/sub && cd sub/sub/sub
git clone https://go.googlesource.com/go
cd go/src
./make.bash

@dsnet dsnet reopened this Jul 19, 2019
@bcmills bcmills added this to the Go1.14 milestone Aug 2, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants