然后,我修改了我的.bashrc为:
export GOPATH=$HOME/Documents/go export GOROOT=$GOPATH export GOARCH=amd64 export GOOS=linux export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN
比起我来的.bashrc,并尝试:
jan@janpc:~$go version go version go1.1 linux/amd64
但是我无法得到它来编译或安装任何依赖项.
例如.我试着运行我的小测试程序:
jan@janpc:~/Documents/go/src/github.com/jan/scrypt$go run scrypt.go warning: GOPATH set to GOROOT (/home/jan/Documents/go) has no effect scrypt.go:9:3: cannot find package "github.com/dchest/scrypt" in any of: /home/jan/Documents/go/src/pkg/github.com/dchest/scrypt (from $GOROOT) ($GOPATH not set) jan@janpc:~/Documents/go/src/github.com/jan/scrypt$
当我尝试安装依赖项时:
jan@janpc:~/Documents/go/src/github.com/jan/scrypt$go get "github.com/dchest/scrypt" warning: GOPATH set to GOROOT (/home/jan/Documents/go) has no effect package github.com/dchest/scrypt: cannot download,$GOPATH must not be set to $GOROOT. For more details see: go help gopath
它在Mac上编译和工作正常.我无法弄清楚我的配置有什么问题,如果我尝试删除$GOROOT或$GOPATH没有任何作用,我不知道还要设置什么,除了Go的路径.
编辑:
我的Mac上没有设置$GOROOT.但是如果我在ubuntu上删除$GOROOT,当我尝试编译时,我会收到一些这样的错误.
cannot find package "fmt" in any of: /usr/local/go/src/pkg/fmt (from $GOROOT) /home/jan/Documents/go/src/fmt (from $GOPATH)