-
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/go: command to print out the directory Go will install binaries into #45546
Comments
maybe we can make |
"go help environment" reports:
Perhaps we could add another value? GOINSTALLDIR or similar. One issue is GOINSTALLDIR would be less permanent than the values listed above. |
or "go tool installdir" |
Duplicate of #23439? |
Also note that you can use |
If you want "go env GOBIN" to always print the answer to this question instead of being empty if $GOBIN is empty, then yes it's a duplicate, however there are a few different ways to potentially solve this problem. |
This is really helpful and does basically what I want, thanks, though I guess the interface could be more intuitive. In the #general channel of the Gophers slack no one has suggested this so far in about 30 minutes, which suggests awareness of this solution is not widespread. |
If you have |
Note this doesn't work to check if binaries are installed if they're not present in go.mod, for example test or build helpers like staticcheck. |
I'd really appreciate the ability to do something like:
|
We see three different use cases and are considering the following fixes.
|
I hit this again this week with a tool within Kubernetes which had not properly set GOPATH and things got splatted all over. What I'd really love to see is a per-{repo, metadata, dir, something} metadata file which lets me set GOBIN, GOCACHE, GOMODCACHE, and other things (anything that defines where go will write files) to a known place. E.g.
|
Honestly, I forgot about that thread, where I made more or less the same request :) That one is closed, but yeah - a per-workspace or even per-directory go.env seems like it would do what I want. |
Go can install binaries into one of several locations, I think:
I'm working with several people who are not really Go programmers, but need to install Go services in order to do their jobs (frontend programming, design, etc). It's a frequent pattern to have instructions that say like "run go install ./... and then start the server" and then they get "meter-server: command not found" because they haven't added whatever directory to their $PATH. So then I need to figure out where Go is actually installing binaries to and then walk them through that process. This is more difficult now when I can't sit right next to them and walk through the commands.
Having a way to easily see which directory Go is installing, or going to, install packages would be very helpful.
Going beyond that, a tool in the x/tools that can append that directory to your $PATH, based on your shell, would be extremely helpful.
The text was updated successfully, but these errors were encountered: