Comments (6)
首先,如果你的 GOPROXY
环境变量是 https://goproxy.cn
,那么你会拿到一个 404 错误,并且是一个正常的 404 错误,因为 k8s 并不存在 v0.0.0
这个版本。
其次,如果你的 GOPROXY
环境变量是 https://goproxy.cn,direct
,那么你会拿到一个网络超时错误,因为这个工作原理是 goproxy.cn
返回给你了 404(和上面的理由一样),然后 Go 模块选择走你指定的这个 direct
,也就是直连 k8s.io 这个域名,由于它被墙了,所以网络超时。
你遇到的这两个错误均是 k8s 本身的锅,据我所知他们已经在着手解决了,你可以去他们的 Issues 里查看。
from goproxy.cn.
@aofei 感谢您的回复。
我在k8s的一个issue中找到了方法。后续的人也可以参考这个:kubernetes/kubernetes#79384 (comment)
from goproxy.cn.
可以,你可能用错了吧,或者忽略了什么设置,麻烦给我看一下你的 go env
内容。
from goproxy.cn.
[root@hl-k8s-test3 admission-webhook-example]# go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/gopath"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/gopath/src/github.com/cnych/admission-webhook-example/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build651513223=/tmp/go-build -gno-record-gcc-switches"
然后执行go build会有下面的问题:
# go build
go: k8s.io/[email protected] requires
k8s.io/[email protected]: reading https://goproxy.cn/k8s.io/api/@v/v0.0.0.mod: 404 Not Found
go get 的时候也报k8s.io/[email protected]: reading https://goproxy.cn/k8s.io/api/@v/v0.0.0.mod: 404 Not Found类似的错误
from goproxy.cn.
@aofei
感谢您的回复,还有下面的问题:
go build main.go webhook.go
go: finding github.com/golang/glog latest
go: finding github.com/ghodss/yaml v1.0.0
go: downloading github.com/ghodss/yaml v1.0.0
go: extracting github.com/ghodss/yaml v1.0.0
go: k8s.io/[email protected] requires
k8s.io/[email protected]: unrecognized import path "k8s.io/api" (https fetch: Get https://k8s.io/api?go-get=1: dial tcp 35.201.71.162:443: i/o timeout)
[root@hl-k8s-test3 kube-mutating-webhook-tutorial]# go get -v -u k8s.io/api
k8s.io/api
go build k8s.io/api: no non-test Go files in /home/gopath/pkg/mod/k8s.io/[email protected]
from goproxy.cn.
@helios741 看了这个链接:kubernetes/kubernetes#79384 (comment),麻烦问一下这个脚本怎么用呢?
#!/bin/sh
set -euo pipefail
VERSION=${1#"v"}
if [ -z "$VERSION" ]; then
echo "Must specify version!"
exit 1
fi
MODS=($(
curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod |
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
))
for MOD in "${MODS[@]}"; do
V=$(
go mod download -json "${MOD}@kubernetes-${VERSION}" |
sed -n 's|.*"Version": "\(.*\)".*|\1|p'
)
go mod edit "-replace=${MOD}=${MOD}@${V}"
done
go get "k8s.io/kubernetes@v${VERSION}"
@aofei 感谢您的回复。
我在k8s的一个issue中找到了方法。后续的人也可以参考这个:kubernetes/kubernetes#79384 (comment)
from goproxy.cn.
Related Issues (20)
- 问题:vscode 远程开发,goproxy 怎么配置? HOT 11
- 问题:内网搭建 最近出现了 502 的报错 HOT 4
- 问题go: google.golang.org/protobuf/encoding/[email protected]: reading https://goproxy.cn/google.golang.org/protobuf/encoding/protojson/@v/v1.30.0.mod: 404 Not Found HOT 1
- 问题:找不到我发布的module HOT 1
- 问题:goproxy.io与goproxy.cn go.sum值不同 HOT 9
- 问题:but does not contain package
- Question: goproxy.cn 504 gateway timeout today HOT 4
- 问题:是否可以使用curl去下载某个链接 HOT 2
- 问题:拉取私有仓库代码问题
- 问题:建议goproxy.cn页面的使用指南,去掉两个$符号,方便复制;同时也可以加一个便捷复制按钮; HOT 1
- 问题:github上上传了我的项目,并创建了release,需要多久才能从goproxy.cn获取到我上传的项目的依赖 HOT 1
- 问题:force push 同一版本号后如何刷新代理上的缓存 HOT 4
- 问题:统计数据近30日的数据都是0,是异常还是数据本来是0? HOT 1
- 问题: HOT 1
- Bug: Cant fetch https://github.com/klauspost/compress HOT 5
- 问题:如何引用私有仓库的子项目 HOT 2
- 问题:如果不小心把隐私信息存储到包中,goproxy.cn这边缓存了,那么如何清除掉缓存呢? HOT 1
- 问题:wget下载模块下的某个包 HOT 2
- 问题:如何通过公司内网代理来访问? HOT 3
- 问题: verifying module: invalid GOSUMDB: malformed verifier id HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goproxy.cn.