工具存放在哪里?

时间:2018-10-14 14:19:40

标签: go

我很难确定工具中当前位于何处。

$ go tool
cgo
cover
vet

cover不在路径上

$ which cover
/usr/bin/which: no cover in ...

这是围棋环境:

$ go env
GOARCH="amd64"
GOBIN="~/go//bin"
GOCACHE="~/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="~/go/"
GORACE=""
GOROOT="/usr/bin/go"
GOTMPDIR=""
GOTOOLDIR="/usr/libexec/gcc/x86_64-redhat-linux/8"
GCCGO="/usr/bin/gccgo"

~/go/bin为空:

$ ls -a ~/go/
.  ..  pkg  

去哪里挑选工具?

1 个答案:

答案 0 :(得分:2)

在我的安装中,它们位于GOTOOLDIR输出的go env中。

~% go env | grep GOTOOLDIR
GOTOOLDIR="/usr/local/Cellar/go/1.11.1/libexec/pkg/tool/darwin_amd64"
~% ls /usr/local/Cellar/go/1.11.1/libexec/pkg/tool/darwin_amd64
addr2line buildid   cover     fix       objdump   test2json
api       cgo       dist      link      pack      trace
asm       compile   doc       nm        pprof     vet