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

cmd/go: 'malformed record data' for goproxy.io sumdb proxy response when version is invalid #34394

Closed
DingKingTim opened this issue Sep 19, 2019 · 6 comments

Comments

@DingKingTim
Copy link

@DingKingTim DingKingTim commented Sep 19, 2019

What version of Go are you using (go version)?

$ go version
go version go1.13 darwin/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dk/Library/Caches/go-build"
GOENV="/Users/dk/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dk/Public/go"
GOPRIVATE=""
GOPROXY="https://goproxy.io"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dk/github/lacr_admin/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=/var/folders/8t/6_sy1kb90gscgqgj67fdrjbw0000gn/T/go-build067542338=/tmp/go-build -gno-record-gcc-switches -fno-common"

I got error when I was testing micro example(https://github.com/micro/examples/tree/master/config/grpc/srv). it report:

verifying github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9/go.mod: github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9/go.mod: malformed record data

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Sep 19, 2019

Please mention the exact steps that you performed so that we can reproduce this.

@DingKingTim

This comment has been minimized.

Copy link
Author

@DingKingTim DingKingTim commented Sep 20, 2019

steps that I performed(Before to do the flowing step I executed go clean -modcache):

$ git clone https://github.com/micro/examples.git
$ cd examples/config
$ go mod init config
$ go mod tidy
verifying github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9/go.mod: github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9/go.mod: malformed record data

@tmthrgd

This comment has been minimized.

Copy link
Contributor

@tmthrgd tmthrgd commented Sep 20, 2019

The pseudo version is wrong, if you visit https://sum.golang.org/lookup/github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9 you'll see:

not found: github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9: invalid pseudo-version: revision is shorter than canonical (65acae22fc9d)

The correct pseudo-version is actually v0.0.0-20190723190241-65acae22fc9d, and you'll see the sum.golang.org lookup for that succeeds.

When I repeat your commands locally using the official Go proxy (proxy.golang.org) instead of goproxy.io, a clearer failure occurs earlier in go mod tidy:

$ go mod tidy
go: finding github.com/micro/go-micro v1.10.0
go: finding google.golang.org/grpc v1.23.1
go: finding github.com/micro/go-plugins v1.3.0
go: downloading google.golang.org/grpc v1.23.1
go: downloading github.com/micro/go-micro v1.10.0
go: downloading github.com/micro/go-plugins v1.3.0
go: extracting google.golang.org/grpc v1.23.1
go: extracting github.com/micro/go-micro v1.10.0
go: extracting github.com/micro/go-plugins v1.3.0
go: github.com/micro/go-plugins@v1.3.0 requires
	k8s.io/api@v0.0.0-20190726022912-69e1bce1dad5 requires
	github.com/gogo/protobuf@v0.0.0-20190410021324-65acae22fc9: invalid pseudo-version: revision is shorter than canonical (65acae22fc9d)

The error message here you saw isn't ideal because goproxy.io isn't validating pseudo-versions like proxy.golang.org is.

The invalid pseudo-version has actually been fixed in k8s.io/api already with kubernetes/kubernetes#80732, but that new version has not been picked up by micro/go-plugins. There are actually three separate open issues in micro/go-plugins for this: micro/go-plugins#392, micro/go-plugins#394 and micro/go-plugins#396.

You can work around this by adding a replace directive to the go.mod file:

replace github.com/gogo/protobuf v0.0.0-20190410021324-65acae22fc9 => github.com/gogo/protobuf v0.0.0-20190723190241-65acae22fc9d
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 20, 2019

@tmthrgd, thanks for investigating!

One final note: it appears that the malformed record data error observed by @DingKingTim is due to goproxy.io serving the sumdb URLs with the wrong HTTP status (200 instead of something else).

$ curl -sIL https://sum.golang.org/lookup/github.com/gogo/protobuf@v0.0.0-20190410021324-65ac
ae22fc9 | grep '^HTTP'
HTTP/2 410

$ curl -sIL https://goproxy.io/sumdb/sum.golang.org/lookup/github.com/gogo/protobuf@v0.0.0-20
190410021324-65acae22fc9 | grep '^HTTP'
HTTP/2 200

CC @oiooj

@bcmills bcmills changed the title go mod tidy: malformed record data cmd/go: 'malformed record data' for goproxy.io sumdb proxy response when version is invalid Sep 20, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 20, 2019

The fix for this diagnostic seems to belong in goproxy.io rather than the go command, so I don't think there is anything more to be done on the Go project side — closing.

@oiooj

This comment has been minimized.

Copy link
Member

@oiooj oiooj commented Nov 26, 2019

goproxy.io fixed this issue, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.