Navigation Menu

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: 'go get' should show requirement chains for inconsistent versions #35167

Open
jeanbza opened this issue Oct 25, 2019 · 6 comments
Open
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@jeanbza
Copy link
Member

jeanbza commented Oct 25, 2019

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

$ go version
go version go1.13.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/deklerk/Library/Caches/go-build"
GOENV="/Users/deklerk/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/deklerk/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
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="/tmp/foo/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/c2/cvxltzcd66v5lx14hm1j76q000h16k/T/go-build418507423=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ go get cloud.google.com/go/pubsub@v1.0.1-beta.ordered.keys
go: finding cloud.google.com v1.0.1-beta.ordered.keys
go: finding cloud.google.com/go v1.0.1-beta.ordered.keys
go get: inconsistent versions:
	cloud.google.com/go/pubsub@v1.0.1-beta.ordered.keys requires cloud.google.com/go/pubsub@v1.0.1 (not cloud.google.com/go/pubsub@v1.0.1-beta.ordered.keys)
$

What did you expect to see?

It works.

What did you see instead?

It does not work. I assume it's because there's a path from v1.0.1-beta to v1.0.1 (see below), but not sure why that's a problem.

deklerk at deklerk-macbookpro2 in ~/workspace/google-cloud-go/pubsub on pubsub-ordered-keys
$ go mod graph | grep pubsub
cloud.google.com/go/pubsub cloud.google.com/go@v0.46.3
cloud.google.com/go/pubsub cloud.google.com/go/storage@v1.0.0
cloud.google.com/go/pubsub github.com/golang/protobuf@v1.3.2
cloud.google.com/go/pubsub github.com/google/go-cmp@v0.3.0
cloud.google.com/go/pubsub github.com/googleapis/gax-go/v2@v2.0.5
cloud.google.com/go/pubsub go.opencensus.io@v0.22.0
cloud.google.com/go/pubsub golang.org/x/exp@v0.0.0-20190912063710-ac5d2bfcbfe0
cloud.google.com/go/pubsub golang.org/x/oauth2@v0.0.0-20190604053449-0f29369cfe45
cloud.google.com/go/pubsub golang.org/x/sync@v0.0.0-20190423024810-112230192c58
cloud.google.com/go/pubsub golang.org/x/time@v0.0.0-20190308202827-9d24e82272b4
cloud.google.com/go/pubsub golang.org/x/tools@v0.0.0-20190917162342-3b4f30a44f3b
cloud.google.com/go/pubsub google.golang.org/api@v0.9.0
cloud.google.com/go/pubsub google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51
cloud.google.com/go/pubsub google.golang.org/grpc@v1.21.1
cloud.google.com/go/pubsub@v1.0.1 cloud.google.com/go@v0.45.1
cloud.google.com/go/pubsub@v1.0.1 google.golang.org/grpc@v1.21.1
cloud.google.com/go/pubsub@v1.0.1 google.golang.org/genproto@v0.0.0-20190819201941-24fa4b261c55
cloud.google.com/go/pubsub@v1.0.1 google.golang.org/api@v0.9.0
cloud.google.com/go/pubsub@v1.0.1 golang.org/x/time@v0.0.0-20190308202827-9d24e82272b4
cloud.google.com/go/pubsub@v1.0.1 golang.org/x/sync@v0.0.0-20190423024810-112230192c58
cloud.google.com/go/pubsub@v1.0.1 golang.org/x/oauth2@v0.0.0-20190604053449-0f29369cfe45
cloud.google.com/go/pubsub@v1.0.1 go.opencensus.io@v0.22.0
cloud.google.com/go/pubsub@v1.0.1 github.com/googleapis/gax-go/v2@v2.0.5
cloud.google.com/go/pubsub@v1.0.1 github.com/google/go-cmp@v0.3.0
cloud.google.com/go/pubsub@v1.0.1 github.com/golang/protobuf@v1.3.2
cloud.google.com/go@v0.46.3 cloud.google.com/go/pubsub@v1.0.1
@jayconrod
Copy link
Contributor

The inconsistent versions error comes from go get, when you request two different versions of a module either explicitly or indirectly. There's no way for go get to give you the version that you asked for For example:

$ go get -d rsc.io/quote@v1.5.1 rsc.io/quote@v1.5.2
go get: conflicting versions for module rsc.io/quote: v1.5.1 and v1.5.2

In this case, it happens because the module transitively requires a newer version of itself. cloud.google.com/go/pubsub@v1.0.1-beta.ordered.keys requires cloud.google.com/go@v0.46.3, but that requires cloud.google.com/go/pubsub@v1.0.1. go get can't give you v1.0.1-beta.ordered.keys because MVS would give you v1.0.1.

Is v1.0.1-beta.ordered.keys based on v1.0.1? It should most likely be retagged as v1.0.2-beta.ordered.keys so that it comes after v1.0.1 according to semver comparison.

@jayconrod
Copy link
Contributor

I think we should probably show a better error message here the full chain of requirements.

gorelease should also warn about this condition.

@jayconrod jayconrod added GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done. labels Oct 28, 2019
@jayconrod jayconrod added this to the Backlog milestone Oct 28, 2019
@jeanbza
Copy link
Member Author

jeanbza commented Oct 28, 2019

Ah! So the solution is to tag v1.0.2-whatever?

@jayconrod
Copy link
Contributor

Yes, just so it sorts after v1.0.1.

If there's anything after a - in a version, it's considered a prerelease. v1.0.1-whatever will sort before v1.0.1 no matter what the -whatever is.

@jeanbza
Copy link
Member Author

jeanbza commented Oct 29, 2019

That worked - thank you!

$ go get cloud.google.com/go/pubsub@v1.1.0-beta.ordered.keys
go: finding cloud.google.com/go v1.1.0-beta.ordered.keys
go: finding cloud.google.com v1.1.0-beta.ordered.keys
go: finding cloud.google.com/go/pubsub v1.1.0-beta.ordered.keys
go: downloading cloud.google.com/go/pubsub v1.1.0-beta.ordered.keys
go: extracting cloud.google.com/go/pubsub v1.1.0-beta.ordered.keys
$

Do you want to close this issue, or use it track "better error message"?

@jayconrod
Copy link
Contributor

Let's track it as a diagnostic issue. A better message would be:

go get: inconsistent versions:
	cloud.google.com/go/pubsub@v1.0.1-beta.ordered.keys requires
	cloud.google.com/go@v0.46.3 requires
	cloud.google.com/go/pubsub@v1.0.1 (not cloud.google.com/go/pubsub@v1.0.1-beta.ordered.keys)

@jayconrod jayconrod changed the title cmd/go: inconsistent versions cmd/go: 'go get' should show requirement chains for inconsistent versions Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants