首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何为golang添加受信任的证书

如何为golang添加受信任的证书
EN

Stack Overflow用户
提问于 2018-09-19 00:06:36
回答 1查看 4.1K关注 0票数 5

我试图使用go get或godep为我的项目提取一些依赖项,但我在我的mac中看到了这一点。

代码语言:javascript
运行
复制
KALEI-M-V11L:election kalei$ dep ensure
The following issues were found in Gopkg.toml:

  ✗ unable to deduce repository and source type for "k8s.io/apiextensions-apiserver": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/apiextensions-apiserver?go-get=1": Get https://k8s.io/apiextensions-apiserver?go-get=1: x509: certificate signed by unknown authority
  ✗ unable to deduce repository and source type for "k8s.io/apimachinery": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/apimachinery?go-get=1": Get https://k8s.io/apimachinery?go-get=1: x509: certificate signed by unknown authority
  ✗ unable to deduce repository and source type for "k8s.io/client-go": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/client-go?go-get=1": Get https://k8s.io/client-go?go-get=1: x509: certificate signed by unknown authority
  ✗ unable to deduce repository and source type for "sigs.k8s.io/controller-runtime": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://sigs.k8s.io/controller-runtime?go-get=1": Get https://sigs.k8s.io/controller-runtime?go-get=1: x509: certificate signed by unknown authority
  ✗ unable to deduce repository and source type for "k8s.io/code-generator": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/code-generator?go-get=1": Get https://k8s.io/code-generator?go-get=1: x509: certificate signed by unknown authority
  ✗ unable to deduce repository and source type for "k8s.io/api": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://k8s.io/api?go-get=1": Get https://k8s.io/api?go-get=1: x509: certificate signed by unknown authority

如果我做了卷曲到https://k8s.io/api?go-get=1,它工作得很完美,所以看起来go不信任证书。

有办法配置它吗?

EN

回答 1

Stack Overflow用户

发布于 2019-11-04 18:00:19

根据go 文档

在UNIX系统上,环境变量SSL_CERT_FILE和SSL_CERT_DIR可分别用于覆盖系统默认位置的SSL证书文件和SSL证书文件目录。

示例

代码语言:javascript
运行
复制
SSL_CERT_FILE=/path/to/x509_encoded_cert_file dep ensure
SSL_CERT_DIR=/path/to/dir/ dep ensure
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52396154

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档