使用 godep报错

$godep restore
godep: [WARNING]: godep should only be used inside a valid go package directory and
godep: [WARNING]: may not function correctly. You are probably outside of your $GOPATH.
godep: [WARNING]:	Current Directory: /root/go/k8s-controller-custom-resource
godep: [WARNING]:	$GOPATH: /root/go
godep: error downloading dep (golang.org/x/crypto/ssh/terminal): unrecognized import path "golang.org/x/crypto/ssh/terminal"

尝试使用golang提供的公共代理服务 GOPROXY

$export GOPROXY=https://goproxy.io
$export GO111MODULE=on
$cd /root/go/k8s-controller-custom-resource
$go mod init
warning: GOPATH set to GOROOT (/root/go/k8s-controller-custom-resource) has no effect
go: creating new go.mod: module k8s.io/sample-controller
go: copying requirements from Godeps/Godeps.json
....
$export GOPATH=/root/go
$go mod download
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐