-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: can't load package when GOPATH is under GOROOT #32621
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
Comments
Setting GOPATH within GOROOT is definitely not a supported configuration, but maybe we should generate a better error for it. /cc @jayconrod |
A GOROOT of In particular, if we were to add a |
At any rate, we do have a similar existing diagnostic, if someone wants to expand it using Lines 106 to 111 in 82cf8bc
|
GOROOT is set to /opt/freeware only with gccgo. And I think this is because we are using |
The gccgo default for |
Change https://golang.org/cl/185540 mentions this issue: |
I am unable to reproduce the issue. The only way I can convince go to not find something under GOPATH is to reference it incorrectly. Even when GOPATH is a sub-directory of GOROOT. Can you post the code or at least the |
You're right, my error occurs only because
GO111MODULE=off is just to make a more explicit error. |
@Helflym I still have not be able to reproduce this. Can you at least post the
|
I was using the whole
|
@Helflym Thank you the patience :) I understand now that you are trying to build the golang.org/x/sys/unix package. I was able to reproduce the issue when building this package. I am continuing analysis now. To reproduce:
@FiloSottile Should we just add a warning about this unsupported configuration (and fix the GCC default prefix) or try to find the root cause? |
Let's just detect it early, print a helpful error, and exit. |
@FiloSottile We can't exit. The go build process and as well as some internal test cases change GOPATH to be a subdirectory of GOROOT and expects it to work. So should it just print a helpful warning? |
Which part of the build process, and what tests? It seems weird to rely on an unsupported and apparently broken configuration. |
Building toolchain2 apparently uses this configuration. For an example of a test that uses this, see Line 2464 in a6a7b14
|
@qbradq, can you get things to work by narrowing the check to |
This was going to be my next try :) Unfortunately I broke my hand. That slowed me down. The Go build and test cases are all going to be under |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Timed out. If the issue reoccurs please open a fresh report. |
The go command seems to have trouble parsing the package name when it's under $GOROOT/src.
The error is obvious with gccgo (so also with version 1.12). However, I'm not sure if the error from TIP is related or not.
This alos happen on Fedora 30 (at least with gccgo).
I do agree that having GOPATH under GOROOT isn't the best idea ever. But this is sometime the case on AIX (and maybe Fedora), because default GOROOT is "/opt/freeware" and the RPM are built under "/opt/freeware/src/packages/BUILD".
Therefore, is it a true bug in go command or a problem related to how Go RPMs are delivered ?
The text was updated successfully, but these errors were encountered: