-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/dist: allow Go to be built inside of module root #44209
Comments
|
I don't think there's any architectural reason this can't be done. We've just seen a ton of bizarre errors that come up when GOROOT is nested inside a module or a GOPATH root. |
I'm playing with introducing a |
I don't think there's any reason |
Alright, I'll drop it then. Are you suggesting logic is added to cmd/dist? Know a good place to start? |
More likely
Once |
Change https://golang.org/cl/291069 mentions this issue: |
Change https://golang.org/cl/291289 mentions this issue: |
@jayconrod @dmitshur - We now have two ways of fixing this - https://golang.org/cl/291069 and https://golang.org/cl/291289 . Can you make a decision about which you like better (or neither) so we can move ahead in some direction? |
Sorry I haven't reviewed these yet. This issue is still on my radar, but I've had a longer than usual review backlog lately. I'm still hoping this can be solved in cmd/dist without changing cmd/go or adding a go.mod file. Your comment in 291069 surprised me though:
I'd like to spend a bit of time debugging to make sure I understand why that's the case. |
Change https://golang.org/cl/296610 mentions this issue: |
@zx2c4 Thanks for working on this. We ended up going in a slightly different direction: 1) We didn't check in a |
My build system downloads 1.4, downloads newer source, patches it, and then runs ./make.bash. It does this because I have custom patches that require a full rebuild (I can no longer just rebuild cmd/link or similar). I've automated all of this nicely in my makefile, which downloads tarballs, checks hashes, runs build commands, and ultimately
.deps/go/bin/go
exists and works. The rest of my build system then runs withexport PATH := $(CURDIR)/.deps/go/bin:$(PATH)
. All is well.Except for one thing: src/cmd/dist/build.go errors out if you're building in a child directory of something with a go.mod in it:
fatalf("found go.mod file in %s: $GOROOT must not be inside a module", modRoot)
. So that means my makefile has to rename go.mod to go.mod.renamed, or struggle to find a good tmp directory on the same partition for atomic moves or some other type of headache.Instead, it would be nice to be able to run
./make.bash
anywhere, regardless of what the parent directories have in them.Are there any big architectural reasons why this can't be?
The text was updated successfully, but these errors were encountered: