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 cloud.google.com/go@master' chooses a v0.0.0- pseudo-version #34266

Closed
jeanbza opened this issue Sep 12, 2019 · 9 comments
Closed
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jeanbza
Copy link
Member

jeanbza commented Sep 12, 2019

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

$ go version
go version go1.13 linux/amd6

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="/usr/local/google/home/deklerk/dev/go1.13.linux-amd64/go//bin"
GOCACHE="/usr/local/google/home/deklerk/.cache/go-build"
GOENV="/usr/local/google/home/deklerk/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/deklerk/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/google/home/deklerk/dev/go1.13.linux-amd64/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/deklerk/dev/go1.13.linux-amd64/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build484796474=/tmp/go-build -gno-record-gcc-switches"

What did you do?

deklerk at deklerk in /tmp/foo
$ go get cloud.google.com/go@master
go: finding cloud.google.com/go master
go get: inconsistent versions:
	cloud.google.com/go@v0.0.0-20190912161704-ff0e67b94976 from cloud.google.com/go@master requires cloud.google.com/go@v0.45.1 (not cloud.google.com/go@v0.0.0-20190912161704-ff0e67b94976 from cloud.google.com/go@master)

What did you expect to see?

It works.

What did you see instead?

It provides a go get: inconsistent versions error.

@jeanbza
Copy link
Member Author

jeanbza commented Sep 12, 2019

$ export GOPROXY=direct does not fix it.

However, the following does:

$ GOPROXY=direct go get cloud.google.com/go@v0.45.2-0.20190912161704-ff0e67b94976
$ GOPROXY=direct go get cloud.google.com/go@master
go: finding cloud.google.com/go master
$

@bcmills
Copy link
Contributor

bcmills commented Sep 12, 2019

Possibly related to #34092, in that both seem to be symptoms of incomplete git histories.

@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 12, 2019
@bcmills bcmills added this to the Go1.14 milestone Sep 12, 2019
@bcmills bcmills self-assigned this Sep 12, 2019
@bcmills bcmills changed the title cmd/go: transient inconsistent versions cmd/go: 'go get cloud.google.com/go@master' chooses a v0.0.0- pseudo-version Sep 12, 2019
@bcmills
Copy link
Contributor

bcmills commented Sep 13, 2019

This is looking like another JGit bug to me: fetches from cloud.google.com/go do not return sufficient history, while the same fetches from github.com/googleapis/google-cloud-go do.

(The repo for cloud.google.com/go is served from https://code.googlesource.com/gocloud, which I believe uses a fork of JGit under the hood. See previously #31399; CC @draftcode.)

$ GO111MODULE=on GOPROXY=direct gotip list -m cloud.google.com/go@master
go: finding cloud.google.com/go master
cloud.google.com/go v0.0.0-20190912234516-79f6ed72c950

$ GO111MODULE=on GOPROXY=direct gotip list -m github.com/googleapis/google-cloud-go@master
go: finding github.com/googleapis/google-cloud-go master
github.com/googleapis/google-cloud-go v0.45.2-0.20190912234516-79f6ed72c950

$

@bcmills
Copy link
Contributor

bcmills commented Sep 13, 2019

I have filed a Google-internal bug to track the issue in the code.googlesource.com server. Will post here with any relevant updates.

@bcmills
Copy link
Contributor

bcmills commented Sep 23, 2019

@gopherbot, please backport to Go 1.13. This can cause errors in pseudo-version resolution, and the workarounds are not at all obvious.

@gopherbot
Copy link

Backport issue(s) opened: #34477 (for 1.13).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@bcmills
Copy link
Contributor

bcmills commented Sep 23, 2019

The workaround, in this case, is to pass go get the specific pseudo-version corresponding to the HEAD revision.

@gopherbot
Copy link

Change https://golang.org/cl/196961 mentions this issue: cmd/go/internal/modfetch/codehost: work around an apparent bug in 'git fetch --unshallow'

@gopherbot
Copy link

Change https://golang.org/cl/197060 mentions this issue: [release-branch.go1.13] cmd/go/internal/modfetch/codehost: work around an apparent bug in 'git fetch --unshallow'

gopherbot pushed a commit that referenced this issue Sep 25, 2019
…d an apparent bug in 'git fetch --unshallow'

When 'git fetch' is passed the '--unshallow' flag, it assumes that the
local and remote refs are equal.¹ However, we were fetching an
expanded set of refs explicitly in the same command, violating that
assumption.

Now we first expand the set of refs, then unshallow the repo in a
separate fetch. Empirically, this seems to work, whereas the opposite
order does not.

¹https://github.com/git/git/blob/4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a/transport.c#L1303-L1309

Updates #34266
Fixes #34477

Change-Id: Ie97eb7c1223f944003a1e31d0ec9e69aad0efc0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/196961
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
(cherry picked from commit 1804bba)
Reviewed-on: https://go-review.googlesource.com/c/go/+/197060
@golang golang locked and limited conversation to collaborators Sep 23, 2020
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants