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

为什么在运行`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条)

报告相同问题?

悬赏问题

  • ¥15 能给我一些人生建议吗
  • ¥15 mac电脑,安装charles后无法正常抓包
  • ¥18 visio打开文件一直显示文件未找到
  • ¥15 请教一下,openwrt如何让同一usb储存设备拔插后设备符号不变?
  • ¥30 使用quartz框架进行分布式任务定时调度,启动了两个实例,但是只有一个实例参与调度,另外一个实例没有参与调度,不知道是为什么?请各位帮助看一下原因!!
  • ¥50 怎么获取Ace Editor中的python代码后怎么调用Skulpt执行代码
  • ¥30 fpga基于dds生成幅值相位频率和波形可调的容易信号发生器。
  • ¥15 R语言shiny包和ncdf4包报错
  • ¥15 origin绘制有显著差异的柱状图和聚类热图
  • ¥20 simulink实现滑模控制和pid控制对比,提现前者优势