macos - 在 OSX Yosemite 上设置 Go 环境时遇到问题

标签 macos go

我已经使用 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/

相关文章:

django - 通过 NFS 上传文件时出现 OSerror

linux - 在 Bash 中提取部分字符串

json - Golang解析输出以读取键(地形输出)

json - golang json编码返回{}为空 map

go - golang 插件可以用于工厂功能吗?

mysql - 如何将值从 MySQL 传递到模板

apache - 删除 MAMP 后从终端启动 apache 时出错

macos - 在 MacOS 上计算每个进程的内存使用情况

cocoa - 使用 Mac 应用程序保存文件 - 文件扩展名

cookies - 使用 net/http 设置 cookie