我已经使用 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 安装 Go 的位置。
在我的例子中,export GOROOT=/usr/local/Cellar/go/1.4.1/libexec
解决了它。
关于macos - 在 OSX Yosemite 上设置 Go 环境时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28253796/