How do I control where `go get` puts things?

huangapple go评论71阅读模式
英文:

How do I control where `go get` puts things?

问题

当我使用go get命令获取一个包(比如godoc),它会想要在/usr/lib/go/bin目录下创建并安装该包(这是一个使用标准Go软件包的Ubuntu系统)。

这并不好,因为作为一个合格的Debian用户,我只允许.deb软件包将东西安装到/usr目录下。

我该如何说服它将包安装到我的GOPATH工作空间或者/usr/local目录的某个位置呢?

英文:

When I go get a package (say, godoc), it wants to create and install it in /usr/lib/go/bin (this is an Ubuntu system using the stock Go packages).

This isn't cool, because like a good Debian user I only let .deb packages install stuff into /usr.

How do I convince it to install into either my GOPATH workspace, or somewhere under /usr/local?

答案1

得分: 2

正确答案是安装golang-go.tools软件包。

英文:

The correct answer turned out to be installing the golang-go.tools package.

答案2

得分: 0

如果您使用GVM而不是通过apt安装Go,则它们将被放置在~/.gvm/gos/或您的$GOPATH中。

https://github.com/moovweb/gvm

此外,我认为godoc不再随1.3版本一起提供,必须从go.tools安装。

http://godoc.org/code.google.com/p/go.tools/cmd/godoc

http://golang.org/doc/go1.2#go_doc

> "go doc"命令已被删除。

英文:

If you install Go with GVM instead of from apt they will be placed in ~/.gvm/gos/ or your $GOPATH instead.

https://github.com/moovweb/gvm

Also I don't think godoc comes with 1.3 anymore, it has to be installed from go.tools

http://godoc.org/code.google.com/p/go.tools/cmd/godoc

http://golang.org/doc/go1.2#go_doc

> The "go doc" command is deleted.

huangapple
  • 本文由 发表于 2014年10月10日 11:12:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/26291382.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定