dongshi1880 2015-10-14 07:06
浏览 242
已采纳

为什么在运行`go get golang.org / x / tools / cmd / godoc`时没有创建二进制文件?

godoc and gotour can be built and run from their respecitve source directory with go build. What is the reason a gotour binary created when one go get it and that is not the case for godoc.

Command Line Output:

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> ls

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/.gvm/pkgsets/go1.5.1/global"
GORACE=""
GOROOT="/home/user/.gvm/gos/go1.5.1"
GOTOOLDIR="/home/user/.gvm/gos/go1.5.1/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> go get golang.org/x/tools/cmd/godoc

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> ls
pkg  src

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> go get golang.org/x/tour/gotour

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> ls 
bin  pkg  src

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> ls bin/
gotour

[ user@pc:~/.gvm/pkgsets/go1.5.1/global ]
>> cd src/golang.org/x/tools/cmd/godoc/

[ user@pc:~/.gvm/pkgsets/go1.5.1/global/src/golang.org/x/tools/cmd/godoc ]
>> go build

[ user@pc:~/.gvm/pkgsets/go1.5.1/global/src/golang.org/x/tools/cmd/godoc ]
>> ./godoc 
usage: godoc package [name ...]
    godoc -http=:6060
  -analysis string
        comma-separated list of analyses to perform (supported: type, pointer). See http://golang.org/lib/godoc/analysis/help.html
  -ex
        show examples in command line mode
  -goroot string
        Go root directory (default "/home/user/.gvm/gos/go1.5.1")
  -html
        print HTML in command-line mode
  -http string
        HTTP service address (e.g., ':6060')
  -httptest.serve string
        if non-empty, httptest.NewServer serves on this address and blocks
  -index
....
  • 写回答

2条回答 默认 最新

  • drtwqc3744 2015-10-14 08:00
    关注

    Godoc is special as it is an official tool being part of the Go distribution.

    So if you go get godoc, the result binary will not be placed under $GOPATH/bin where all other executables go, but under $GOROOT/bin.

    Gotour is not special in this way, so it gets installed into your $GOPATH/bin.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别