-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
I want GOPATH==GOROOT effect without creating extra directory #69810
Comments
I wanted behaviour of /opt/go/pkg/mod/github.com being added packages when GOROOT="/opt/go" AND GOPATH="/opt/go/pkg" but when i add that it causes /opt/go/pkg/pkg/mod/github.com Having no GOPATH creates /root/go folder which is also undesirable |
I believe the separation is intentional, see also GOMODCACHE. |
This was referenced Oct 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Go version
go version go1.23.2 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Downloaded tar from golang website, tar -xvf in /opt.
Now
i) GOPATH="/opt/go"
ii) GOROOT="/opt/go"
Then, install any go program
go install github.com/go-acme/lego/v4/cmd/lego@latest
It will be downloaded in /opt/go/pkg cleanly which is desirable but also splits out warning
warning: GOPATH set to GOROOT (/opt/go/) has no effect
but installs go program cleanly.
Now change env to
GOROOT="/opt/go"
GOPATH="/opt/go/pkg"
Then it will unnecessarily create /opt/go/pkg/pkg instead of just using /opt/go/pkg similar to when GOPATH==GOROOT. I am trying to avoid warning of GOPATH==GOROOT but at the same time its unnecessarily creating extra /opt/go/pkg/pkg folder.
What did you see happen?
Extra pkg directory /opt/go/pkg/pkg
What did you expect to see?
No extra pkg directory. Simply install in /opt/go/pkg
The text was updated successfully, but these errors were encountered: