Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reading https://goproxy.cn/sumdb/sum.golang.org/lookup/github.com/zouyx/agollo@v2.2.1+incompatible: 404 Not Found[BUG] #84

Closed
wtiany365 opened this issue Dec 5, 2019 · 31 comments

Comments

@wtiany365
Copy link

请简单描述bug的场景
go 1.13.4
go mod
require github.com/zouyx/agollo v2.2.1+incompatible

如何重现
go mod tidy
出现
verifying github.com/zouyx/agollo@v2.2.1+incompatible/go.mod: github.com/zouyx/agollo@v2.2.1+incompatible/go.mod: reading https://goproxy.cn/sumdb/sum.golang.org/lookup/github.com/zouyx/agollo@v2.2.1+incompatible: 404 Not Found
go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/Cellar/go/1.13.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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=/var/folders/jc/0zx17bhd0tgfk632ddj_r3d40000gn/T/go-build785361234=/tmp/go-build -gno-record-gcc-switches -fno-common"
期望
正常下载

截图
如有

Agollo 版本 :

  • Version [e.g. 22]

日志信息

其他上下文
如有

@zouyx
Copy link
Member

zouyx commented Dec 5, 2019

我没用过你那个代理,我建议更换成阿里这个试试?

GOPROXY=https://mirrors.aliyun.com/goproxy/

@zouyx
Copy link
Member

zouyx commented Dec 5, 2019

这个我试了下没问题的,我估计你那个proxy不支持+incompatible关键字

>set GOPROXY=https://mirrors.aliyun.com/goproxy/
>go mod tidy
go: finding github.com/zouyx/agollo v2.2.1+incompatible
go: finding github.com/tevid/gohamcrest v1.1.1


go: downloading github.com/tevid/gohamcrest v1.1.1
go: extracting github.com/tevid/gohamcrest v1.1.1

@wtiany365
Copy link
Author

go 1.13版本会检查校验和 因为语义化版本的问题,http://sum.golang.org/ 没有收录这个校验和,导致的失败,这个问题什么时候修复呢

@zouyx
Copy link
Member

zouyx commented Dec 5, 2019

我试了下直连和ali的代理都没问题..........应该不是和这个有golang的校验和有关系吧?

我现在还没时间尝试方案,如果有方案欢迎提一下pr。

@wtiany365
Copy link
Author

wtiany365 commented Dec 5, 2019

go的1.12版本是不会校验的,1.13版本开始有的,参考https://sum.golang.org/
I committed a new change (or released a new version) to a repository, why isn't it showing up when I run go get -u or go list -m --versions?
In order to improve our services' caching and serving latencies, new versions may not show up right away. If you want new code to be immediately available in the mirror, then first make sure there is a semantically versioned tag for this revision in the underlying source repository. Then explicitly request that version via go get module@version. After one minute for caches to expire, the go command will see that tagged version. If this doesn't work for you, please file an issue.

@zouyx
Copy link
Member

zouyx commented Dec 5, 2019

image

我之前的go版本是1.12,我更新了成1.13也没发现问题

我估计你可以参考下 goproxy/goproxy.cn#24 这个问题

或者这些问题 404问题

@CodFrm
Copy link
Contributor

CodFrm commented Dec 5, 2019

遇到了同样的问题
使用的代理:
GOPROXY=https://goproxy.cn,direct

$ go get github.com/zouyx/agollo@v2.2.1
go: finding github.com/zouyx/agollo v2.2.1
go: finding github.com/zouyx/agollo v2.2.1
go get github.com/zouyx/agollo@v2.2.1: github.com/zouyx/agollo@v2.2.1: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1
, not v2

在go mod 中添加require github.com/zouyx/agollo v2.2.1+incompatible

go mod tidy
verifying github.com/zouyx/agollo@v2.2.1+incompatible/go.mod: github.com/zouyx/agollo@v2.2.1+incompatible/go.mod: reading https://goproxy.cn/sumdb/sum.golang.org/lookup/githu
b.com/zouyx/agollo@v2.2.1+incompatible: 404 Not Found

后面通过export GOPRIVATE=github.com/zouyx/agollo跳过校验解决

@withlin
Copy link
Collaborator

withlin commented Dec 5, 2019

我这边没有遇到该问题

@zouyx
Copy link
Member

zouyx commented Dec 6, 2019

@wtiany365 是否还有问题?

@CodFrm
Copy link
Contributor

CodFrm commented Dec 6, 2019

image
image
依旧存在

@wtiany365
Copy link
Author

wtiany365 commented Dec 6, 2019

我这里直接用go get github.com/zouyx/agollo@v2.2.1 包可以下载
在go.mod里生成了 github.com/zouyx/agollo v0.0.0-20191114083447-dde9fc9f35b8

@zouyx
Copy link
Member

zouyx commented Dec 6, 2019

@CodFrm @wtiany365 是的,你不使用那个关键字,就不能显示版本,我帮你们去goproxy问问

@CodFrm
Copy link
Contributor

CodFrm commented Dec 6, 2019

@zouyx 不太像是goproxy的问题,去掉goproxy之后,提示的是410错误

image

@wtiany365
Copy link
Author

issues/83
应该跟这个是同一个问题
建议模块名改为github.com/zouyx/agollo/v2

@aofei
Copy link

aofei commented Dec 6, 2019

这个跟 Go 模块代理无关,在 Go 模块代理中 404 被认为是健康的状态,因为 Go 模块需要依靠 404 来实现很多功能(比如模块路径的推算等)。

目前为止,世界上所有代理只有 goproxy.cnproxy.golang.org 支持直接打开那条 404 的 URL 并得到详细错误信息:

https://goproxy.cn/sumdb/sum.golang.org/lookup/github.com/zouyx/agollo@v2.2.1+incompatible

Not Found: github.com/zouyx/agollo@v2.2.1+incompatible: invalid version: +incompatible suffix not allowed: module contains a go.mod file, so semantic import versioning is required

@aofei
Copy link

aofei commented Dec 6, 2019

这个错误的意思是当前你用的模块版本中包含了一个 go.mod 文件(详见:这里),在 Go 上游中已经规定,如若一个模块版本包含了 go.mod 文件,那么其作者就有责任保证该模块版本的符合语义化版本控制规则的标签必须严格遵循 Go 模块的规定,也就是当主版本号不是 v0v1 时主版本号必须显式地出现在模块路径的尾部,当前这个模块的话也就是变成 github.com/zouyx/agollo/v2。这么做的目的是为了防止误发版本号,最初的讨论在这里,提案在这里

另外 goproxy.cn 之所以要一直用上游的 Go 版本,是由于 goproxy.cn 支持了代理 GOSUMDB 的默认值也就是 sum.golang.org,官方代理一直用的是上游的 Go 版本,所以如果我们不用上游那么就会导致 goproxy.cn 放过了但是 sum.golang.org 却没放过的情况发生。

@aofei
Copy link

aofei commented Dec 6, 2019

此外,再说一下 @zouyx 老哥提到的用阿里云 Go 模块代理没有出现问题的具体原因。

首先,阿里云的 Go 模块代理是所有代理中做得最不合规矩的,它存在很多缺陷(比如不支持代理 sum.golang.org,还有在很多情况下会出现本不该出现的 404 甚至 500 等等),其中用旧 Go 版本就是缺陷之一,正是这个缺陷导致了它放过了你的这条拉取。实际上我找朋友给他们反馈过,但是现在看来他们并没有做出任何调整,所以,我个人并不建议大家使用阿里云的 Go 模块代理。

@zouyx
Copy link
Member

zouyx commented Dec 6, 2019

ok,周末我看看怎么修复比较合理,同时会参考下 @CodFrm 的pr,谢谢各位

@zouyx zouyx added the bug label Dec 9, 2019
@zouyx zouyx closed this as completed Dec 9, 2019
@zouyx zouyx reopened this Dec 9, 2019
@zouyx
Copy link
Member

zouyx commented Dec 9, 2019

@CodFrm @wtiany365 我测试了一下,直接按照这样改是不行的,改起来也挺复杂了

@aofei
Copy link

aofei commented Dec 9, 2019

@zouyx 改完之后你还需要释放一个新的补丁版本(打个 Tag),因为你的改动对那个老的(v2.2.1)是不适用的。

@zouyx
Copy link
Member

zouyx commented Dec 9, 2019

@aofei 我试过,还是404或者是410,但是我用另外一个包是可以的。。。。我也没想懂为啥

@aofei
Copy link

aofei commented Dec 9, 2019

@zouyx 报错信息呢?打开那条 404 或者 410 了的 URL 就能看到具体的错误信息的。

@CodFrm
Copy link
Contributor

CodFrm commented Dec 9, 2019

@zouyx
zouyx@bec4f29

这是又改回去了吗?..🌚

@zouyx
Copy link
Member

zouyx commented Dec 9, 2019

😄,我只能这样。。。 @aofei 你在,我改一版给你看看

@zouyx
Copy link
Member

zouyx commented Dec 9, 2019

https://github.com/zouyx/agollo/releases/tag/v2.2.4

这个你们试试可以?我不行。。。。

@aofei
Copy link

aofei commented Dec 9, 2019

没有任何问题:

aofei@as-macbook-pro:~$ go list -m -json github.com/zouyx/agollo/v2@v2.2.4                                                                                                                                                                   
go: finding github.com/zouyx/agollo/v2 v2.2.4
{
        "Path": "github.com/zouyx/agollo/v2",
        "Version": "v2.2.4",
        "Time": "2019-12-09T08:08:07Z"
}

@zouyx
Copy link
Member

zouyx commented Dec 9, 2019

我擦,这个咋可以了,刚才v2.2.3不行。。。。。。

@zouyx
Copy link
Member

zouyx commented Dec 9, 2019

就这样吧。。。 @aofei @CodFrm 就这样吧,谢谢了

@zouyx zouyx closed this as completed Dec 9, 2019
@aofei
Copy link

aofei commented Dec 9, 2019

@zouyx 我猜刚才你使用的模块路径遗漏了“/v2”后缀。从此以后你们代码中对应的 import path 还有 go.mod 文件中对应的模块路径都得使用 github.com/zouyx/agollo/v2 才行,而不再是 github.com/zouyx/agollo 了。

@CodFrm
Copy link
Contributor

CodFrm commented Dec 9, 2019

image
成了,辛苦作者了。

v2.2.3没有看见/v2的路径,我修改的被覆盖了😂

@zouyx
Copy link
Member

zouyx commented Dec 9, 2019

@CodFrm 辛苦你们才对,用v2.2.4吧,还有点功能的wiki,晚点我再弄一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants