go get 失败:x509:无法加载系统根证书并且未提供根证书。

huangapple go评论77阅读模式
英文:

go get failed: x509: failed to load system roots and no roots provided

问题

我正在尝试使用go get安装websocket。

然而,出现了x509: failed to load system roots and no roots provided错误。

我在谷歌上搜索了一下,发现交叉编译需要禁用CGO,所以我执行了export CGO_ENABLED=0

但是还是一直报错。

系统:os x 10.9.1

go版本:go1.2 darwin/amd64

go环境:

GOARCH="amd64"

GOBIN=""

GOCHAR="6"

GOEXE=""

GOHOSTARCH="amd64"

GOHOSTOS="darwin"

GOOS="darwin"

GOPATH="/Users/xxx/gocode"

GORACE=""

GOROOT="/usr/local/Cellar/go/1.2/libexec"

GOTOOLDIR="/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64"

TERM="dumb"

CC="clang"

GOGCCFLAGS="-g -O2 -fPIC -m64 -fno-caret-diagnostics
-Qunused-arguments -fno-common"

CXX="clang++"

CGO_ENABLED="0"

英文:

> go get code.google.com/p/go.net/websocket

I'm trying to install websocket using go get

However, given the x509: failed to load system roots and no roots provided error.

I was google it: cross-compilation requires disabling CGO, so i export CGO_ENABLED=0,

but it always error

system: os x 10.9.1

go version: go1.2 darwin/amd64

go env:

> GOARCH="amd64"
>
> GOBIN=""
>
> GOCHAR="6"
>
> GOEXE=""
>
> GOHOSTARCH="amd64"
>
> GOHOSTOS="darwin"
>
> GOOS="darwin"
>
> GOPATH="/Users/xxx/gocode"
>
> GORACE=""
>
> GOROOT="/usr/local/Cellar/go/1.2/libexec"
>
> GOTOOLDIR="/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64"
>
> TERM="dumb"
>
> CC="clang"
>
> GOGCCFLAGS="-g -O2 -fPIC -m64 -fno-caret-diagnostics
> -Qunused-arguments -fno-common"
>
> CXX="clang++"
>
> CGO_ENABLED="0"

答案1

得分: 2

你是用Homebrew安装的吗?可以尝试以下命令:

brew install go --cross-compile-common --with-cgo --use-gcc

(来源:https://groups.google.com/forum/#!topic/golang-nuts/gyL_jeOyxQA)

否则,你可以直接安装预编译的软件包。

英文:

Did you install with homebrew? Try this:

brew install go --cross-compile-common --with-cgo --use-gcc

(source: https://groups.google.com/forum/#!topic/golang-nuts/gyL_jeOyxQA)

Otherwise, just install the pre-built package.

huangapple
  • 本文由 发表于 2014年2月17日 10:26:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/21819696.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定