go build x509: certificate has expired or is not yet valid

一般go get私有仓库时会出现如下错误:

build XXXXXXXXXX/cmd/main: cannot load XXXXXXXXXXX: unrecognized import path "XXX" (https fetch: Get https://XXXX?go-get=1: x509: certificate has expired or is not yet valid

原因是go get的执行过程需要https证书,检查server端证书是未知CA签署的并报错。

解决方法:
go get -insecure xxx
这样go get就会通过http协议去访问私库了。

posted @ 2021-11-17 16:35  hubb  阅读(2156)  评论(0编辑  收藏  举报