dtvjl64442
2018-05-31 21:32
浏览 47
已采纳

去哪里获取安装软件包?

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.

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.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • ds3464 2018-05-31 21:32
    已采纳

    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
    

    From that I found the executable in question at $HOME/go/bin.

    打赏 评论
  • donglin9717 2019-01-22 05:40

    If you run go get and you already have the package it says nothing (even with the -v option). This is confusing if it's not in the first directory of your GOPATH. Ie you run go get , there is no error or any message but when you check the first directory of the GOPATH (which is where the doc says it should be) you can't find it.

    I eventually found it, but since I have a large GOPATH this was rather tedious.

    打赏 评论

相关推荐 更多相似问题