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: panics on error during downgrade #31942

heschik opened this issue May 9, 2019 · 3 comments


None yet
5 participants
Copy link

commented May 9, 2019

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

$ go version
go version devel +f0c383b833 Wed May 1 16:53:19 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?


What did you do?

Note: this used to reproduce both with and without GOPROXY= but now only reproduces with the mirror. Presumably something changed upstream that hasn't made it to the mirror yet.

$ cd $(mktemp -d)
$ go mod init
$ go mod init
go: creating new go.mod: module
$ go get -u
$ go get -u
go: finding master
go: finding v2.0.0
go: unexpected status ( 410 Gone                                                                                            
panic: error loading module requirements

goroutine 1 [running]:
cmd/go/internal/mvs.Downgrade.func2(0xc00024a3c0, 0x1f, 0xc00056a6c0, 0x6)
        /usr/lib/google-golang/src/cmd/go/internal/mvs/mvs.go:317 +0x659
cmd/go/internal/mvs.Downgrade(0xc00028c810, 0xb, 0x0, 0x0, 0xbdf500, 0xc0001d6000, 0xc00044c040, 0x1, 0x1, 0x0, ...)
        /usr/lib/google-golang/src/cmd/go/internal/mvs/mvs.go:349 +0x617
cmd/go/internal/modget.runGet(0xfd0d40, 0xc000020130, 0x1, 0x1)
        /usr/lib/google-golang/src/cmd/go/internal/modget/get.go:446 +0x1ed6
        /usr/lib/google-golang/src/cmd/go/main.go:219 +0x837

What did you expect to see?

No panic.

What did you see instead?



This comment has been minimized.

Copy link

commented May 14, 2019

I've got bitten by this also.

go version go1.12.5 darwin/amd64

Also reproducible on tip:

go version devel +45d74aa Tue May 14 00:50:42 2019 +0000 darwin/amd64

Steps to reproduce:

After doing:

mkdir test
go mod init
go get

Any of these (among others), fails with the same error:

go get

go get

go get

go get

go get

go get


panic: missing and .../v2/go.mod at revision v2.0.0

goroutine 1 [running]:
cmd/go/internal/mvs.Downgrade.func2(0xc00025e720, 0x1f, 0xc00035121a, 0x6)
	/Users/d.lopez/sdk/gotip/src/cmd/go/internal/mvs/mvs.go:409 +0x676
cmd/go/internal/mvs.Downgrade(0xc0000240c0, 0x33, 0x0, 0x0, 0x1711ec0, 0xc0004c53b0, 0xc0000e7820, 0x1, 0x1, 0x0, ...)
	/Users/d.lopez/sdk/gotip/src/cmd/go/internal/mvs/mvs.go:441 +0x5c7
cmd/go/internal/modget.runGet(0x1a77220, 0xc0000c0050, 0x1, 0x1)
	/Users/d.lopez/sdk/gotip/src/cmd/go/internal/modget/get.go:563 +0x2e8a
	/Users/d.lopez/sdk/gotip/src/cmd/go/main.go:188 +0x57f

@bcmills bcmills added this to the Go1.13 milestone May 14, 2019


This comment has been minimized.

Copy link

commented May 14, 2019

Oh this is fun.

When we downgrade a module, we consider the full module version graph, excluding newer versions of the downgraded module and anything else that requires newer versions. Then we do MVS on whatever's left.

When we require v0.39.1-0.20190513200544-741d62a9e2a8 (the current master), that implies v2.0.4. That requires something that gets excluded, so we try to downgrade to an earlier version. However, gax-go didn't migrate to modules until v2.0.3. v2.0.2 don't have go.mod files, so it's an error to depend on them. They should probably be considered part of the module with a +incompatible suffix, but we don't see that for v2+ modules.

Even if we stopped returning these versions for the v2 module, GOPROXY will serve them forever. This is an easy mistake to make, and the Go command ought to recover from it when downgrading. Fortunately, this shouldn't affect upgrades or anyone getting the module at latest.

One possible fix: if Reqs.Required returns an error for a previous version of a module during a downgrade, we could silently exclude the version. It's currently hard to distinguish between transient errors (we couldn't reach the repository) and permanent errors (we couldn't parse the go.mod), but I think that's the right thing to do.

@jayconrod jayconrod added the NeedsFix label May 14, 2019


This comment has been minimized.

Copy link

commented May 15, 2019

Change mentions this issue: cmd/go: don't attempt to downgrade to incompatible versions

@gopherbot gopherbot closed this in 06642d8 May 17, 2019

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