必承其重 | 欲带皇冠 2011-11-01 17:32 采纳率: 50%
浏览 269
已采纳

Gopath 和 GOROOT 的价值观应该是什么?

I'm trying to install doozer like this

$ goinstall github.com/ha/doozer

I get these errors.

goinstall: os: go/build: package could not be found locally
goinstall: fmt: go/build: package could not be found locally
goinstall: io: go/build: package could not be found locally
goinstall: reflect: go/build: package could not be found locally
goinstall: math: go/build: package could not be found locally
goinstall: rand: go/build: package could not be found locally
goinstall: url: go/build: package could not be found locally
goinstall: net: go/build: package could not be found locally
goinstall: sync: go/build: package could not be found locally
goinstall: runtime: go/build: package could not be found locally
goinstall: strings: go/build: package could not be found locally
goinstall: sort: go/build: package could not be found locally
goinstall: strconv: go/build: package could not be found locally
goinstall: bytes: go/build: package could not be found locally
goinstall: log: go/build: package could not be found locally
goinstall: encoding/binary: go/build: package could not be found locally

转载于:https://stackoverflow.com/questions/7970390/what-should-be-the-values-of-gopath-and-goroot

  • 写回答

12条回答 默认 最新

  • ?yb? 2012-06-01 08:46
    关注

    GOPATH is discussed in the cmd/go documentation:

    The GOPATH environment variable lists places to look for Go code. On Unix, the value is a colon-separated string. On Windows, the value is a semicolon-separated string. On Plan 9, the value is a list.

    GOPATH must be set to get, build and install packages outside the standard Go tree.

    GOROOT is discussed in the installation instructions:

    The Go binary distributions assume they will be installed in /usr/local/go (or c:\Go under Windows), but it is possible to install the Go tools to a different location. In this case you must set the GOROOT environment variable to point to the directory in which it was installed.

    For example, if you installed Go to your home directory you should add the following commands to $HOME/.profile:

    export GOROOT=$HOME/go
    export PATH=$PATH:$GOROOT/bin
    

    Note: GOROOT must be set only when installing to a custom location.

    (updated version of Chris Bunch's answer.)

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

报告相同问题?