在Mac OS X上,Golang x509加载系统根证书失败的错误。

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

Golang x509 Failed to load system roots error on Mac OS X

问题

我在本地机器上进行API调用时遇到了一个错误。

x509: failed to load system roots and no roots provided

go env:

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/usr/local/Cellar/go/1.3.3"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.3.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.3.3/libexec/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"
英文:

I am getting an error making api calls on my local machine.

x509: failed to load system roots and no roots provided

go env:

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/usr/local/Cellar/go/1.3.3"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.3.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.3.3/libexec/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"

答案1

得分: 0

你需要使用Homebrew安装不带cgo的Go语言,可以按照以下步骤进行操作:

  1. 移除已安装的Go语言:
brew remove go
  1. 安装不带cgo的Go语言:
brew install go --without-cgo

请注意,这些命令需要在终端中执行,并确保已经安装了Homebrew。

英文:

You need to install go from homebrew without cgo:

brew remove go
brew install go --without-cgo

huangapple
  • 本文由 发表于 2014年10月31日 22:25:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/26676964.html
匿名

发表评论

匿名网友

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

确定