我已经使用Homebrew在OSX上安装了Go,以便我可以安装alpaca,但不断收到这样的错误:
package github.com/GeertJohan/go.rice/rice
imports github.com/GeertJohan/go.incremental
imports github.com/GeertJohan/go.rice/embedded
imports github.com/akavel/rsrc/binutil
imports github.com/akavel/rsrc/coff
imports github.com/daaku/go.zipexe
imports github.com/jessevdk/go-flags
imports github.com/robertkrimen/terst
imports testing: unrecognized import path "testing"
package github.com/GeertJohan/go.rice/rice
imports github.com/GeertJohan/go.incremental
imports github.com/GeertJohan/go.rice/embedded
imports github.com/akavel/rsrc/binutil
imports github.com/akavel/rsrc/coff
imports github.com/daaku/go.zipexe
imports github.com/jessevdk/go-flags
imports github.com/robertkrimen/terst
imports bitbucket.org/kardianos/osext
imports bitbucket.org/pkg/inflect
imports unicode: unrecognized import path "unicode"
make: *** [deps] Error 1
谷歌搜索似乎问题出在我的 go 环境中,但我似乎无法弄清楚如何解决这个问题。这是我运行go env
时看到的:
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mc/go"
GORACE=""
GOROOT="/Users/mc/go/packages"
GOTOOLDIR="/Users/mc/go/packages/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
我在这里做错了什么?
好的,@not_a_golfer的评论帮助我弄清楚了这一点——GOROOT 需要是安装 brew 的地方。
就我而言,export GOROOT=/usr/local/Cellar/go/1.4.1/libexec
解决了它。
GOROOT="/Users/mc/go/packages"
不正确。
您不必设置GOROOT
。 查看戴夫切尼的这篇博文。