问题描述
我已经获得了运行go get <some-remote-git-repo>
的指令,该指令似乎成功了,但是我不清楚该软件包的安装位置,因此可以从中运行可执行文件.
I've been given instructions to run go get <some-remote-git-repo>
which seems to succeed, but it's not clear to me where the package was installed to so I can run an executable from it.
每个 https://golang.org/doc/code.html#remote 似乎它将安装在$GOPATH/bin
中,但在我的shell中未定义$GOPATH
(尽管go get
命令似乎可以正常工作). Go是通过Homebrew安装的.
Per https://golang.org/doc/code.html#remote it seems it will be installed in $GOPATH/bin
but $GOPATH
isn't defined in my shell (though the go get
command seems to work fine). Go is installed via Homebrew.
推荐答案
我通过运行brew info go
找到了丢失的线索,它说:
I found the missing clue by running brew info go
, which says:
==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
https://golang.org/doc/code.html#GOPATH
由此,我在$HOME/go/bin
中找到了相关的可执行文件.
From that I found the executable in question at $HOME/go/bin
.
这篇关于去哪里获取安装软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!