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: "unknown revision" error for valid pseudo-version of golang.org/x/tools #34092

Closed
myitcv opened this issue Sep 4, 2019 · 7 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

@myitcv
Copy link
Member

myitcv commented Sep 4, 2019

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

$ go version
go version devel +9da7abd2eb Tue Sep 3 18:35:32 2019 +0000 linux/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="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/govim/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-build658226068=/tmp/go-build -gno-record-gcc-switches"

What did you do?

export GOPATH=$(mktemp -d)
export PATH=$GOPATH/bin:$PATH
cd $(mktemp -d)
export GO111MODULE=on
GOPROXY=direct go get golang.org/x/tools/gopls@master

At the time of writing, a4fdb3a is the commit at master

What did you expect to see?

The command to succeed.

What did you see instead?

go: finding golang.org/x/tools master
go: finding golang.org/x/tools/gopls master
go: downloading golang.org/x/tools v0.0.0-20190904211325-a4fdb3a8b281
go: downloading golang.org/x/tools/gopls v0.0.0-20190904211325-a4fdb3a8b281
go: extracting golang.org/x/tools/gopls v0.0.0-20190904211325-a4fdb3a8b281
go: extracting golang.org/x/tools v0.0.0-20190904211325-a4fdb3a8b281
go get: golang.org/x/tools/gopls@v0.0.0-20190904211325-a4fdb3a8b281 requires
        golang.org/x/tools@v0.0.0-20190904201204-7dc6b39912d7: invalid version: unknown revision 7dc6b39912d7

However golang.org/x/tools@v0.0.0-20190904201204-7dc6b39912d7 is indeed valid:

export GOPATH=$(mktemp -d)
cd $(mktemp -d)
go mod init mod
go get golang.org/x/tools@v0.0.0-20190904201204-7dc6b39912d7

cc @bcmills @jayconrod

@myitcv myitcv added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Sep 4, 2019
@bcmills bcmills added this to the Go1.14 milestone Sep 4, 2019
@hyangah
Copy link
Contributor

hyangah commented Sep 4, 2019

More interestingly, if try the last go get command again, it succeeds

export GOPATH=$(mktemp -d)
export PATH=$GOPATH/bin:$PATH
cd $(mktemp -d)
export GO111MODULE=on
GOPROXY=direct go get golang.org/x/tools/gopls@master
go: finding golang.org/x/tools master
go: finding golang.org/x/tools/gopls master
go: downloading golang.org/x/tools v0.0.0-20190904213738-958971f5c2bf
go: downloading golang.org/x/tools/gopls v0.0.0-20190904213738-958971f5c2bf
go: extracting golang.org/x/tools/gopls v0.0.0-20190904213738-958971f5c2bf
go: extracting golang.org/x/tools v0.0.0-20190904213738-958971f5c2bf
go get: golang.org/x/tools/gopls@v0.0.0-20190904213738-958971f5c2bf requires
	golang.org/x/tools@v0.0.0-20190904201204-7dc6b39912d7: invalid version: unknown revision 7dc6b39912d7


GOPROXY=direct go get golang.org/x/tools/gopls@master
go: finding golang.org/x/tools master
go: finding golang.org/x/tools/gopls master
go: downloading golang.org/x/tools/gopls v0.1.4-0.20190904213738-958971f5c2bf
go: extracting golang.org/x/tools/gopls v0.1.4-0.20190904213738-958971f5c2bf
go: downloading golang.org/x/tools v0.0.0-20190904201204-7dc6b39912d7
go: extracting golang.org/x/tools v0.0.0-20190904201204-7dc6b39912d7
go: downloading golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: downloading golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: extracting golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: extracting golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: finding golang.org/x/tools v0.0.0-20190904201204-7dc6b39912d7
go: finding golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: finding golang.org/x/sync v0.0.0-20190423024810-112230192c58

@bcmills
Copy link
Contributor

bcmills commented Sep 13, 2019

This no longer reproduces at head, presumably due to changes in the golang.org/x/tools repo.

At the time of writing, a4fdb3a is the commit at master

There is an interesting fact about that commit: namely, that commit updated the dependency on golang.org/x/tools to the exact previous commit of the same repository. If that fact is relevant, it may be possible to construct a standalone repository that reproduces the error.


It is also interesting to note that the pseudo-version in the output log for that commit of golang.org/x/tools/gopls uses a v0.0.0- prefix, even though that commit has the commit tagged gopls/v0.1.3 as an ancestor. A more appropriate pseudo-version (per #27171) would have been v0.1.4-0.20190904211325-a4fdb3a8b281. The fact that v0.0.0- was used instead suggests a connection to #34266.


~/src/golang.org/x/tools$ git merge-base --is-ancestor -- gopls/v0.1.3 a4fdb3a8b281700221c3bd18a4e4ea48d2becf10 && echo yes || echo no
yes

~/src/golang.org/x/tools$ git merge-base --is-ancestor -- gopls/v0.1.4 a4fdb3a8b281700221c3bd18a4e4ea48d2becf10 && echo yes || echo no
no

@myitcv
Copy link
Member Author

myitcv commented Sep 13, 2019

I think (for some reason I didn't record the commit) this happened again at 6bfd74c. I'll be sure to log any further occurrences here.

@bcmills bcmills changed the title cmd/go: unknown revision error for valid pseudo version via GOPROXY=direct get cmd/go: "unknown revision" error for valid pseudo-version of golang.org/x/tools Sep 13, 2019
@bcmills
Copy link
Contributor

bcmills commented Sep 13, 2019

Based on the investigation in #34266 (comment), I believe this may be a bug in the server backing go.googlesource.com.

I will wait until that bug has been investigated before pursuing this further.

@bcmills
Copy link
Contributor

bcmills commented Sep 18, 2019

This appears to be a bug in some (all?) versions of the git command, triggered when a --unshallow fetch also expands the set of references. We will need to work around it in the go command, presumably by splitting the “unshallow the repo” and “fetch all refs and heads” steps into two separate git invocations.

@bcmills
Copy link
Contributor

bcmills commented Sep 24, 2019

The go command at head contains a workaround for the suspected git bug. Please let us know if you see this again using a newer build of the go tool.

@glnsagar
Copy link

glnsagar commented Apr 27, 2020

make all WHAT=edgecore
bash hack/verify-golang.sh
go detail version: go version go1.13.6 linux/amd64
go version: 1.13.6
hack/make-rules/build.sh edgecore
building github.com/kubeedge/kubeedge/edge/cmd/edgecore
+ go build -o /usr/lib/go/src/github.com/kubeedge/kubeedge/_output/local/bin/edgecore -ldflags '-X github.com/kubeedge/kubeedge/pkg/version.buildDate=2020-04-27T21:26:25Z -X github.com/kubeedge/kubeedge/pkg/version.gitCommit=27b028532ee4d596859fe62b4081883f7090a5e0 -X github.com/kubeedge/kubeedge/pkg/version.gitTreeState=clean -X github.com/kubeedge/kubeedge/pkg/version.gitVersion=v1.3.0-alpha.0.5+27b028532ee4d5 -X github.com/kubeedge/kubeedge/pkg/version.gitMajor=1 -X github.com/kubeedge/kubeedge/pkg/version.gitMinor=3+' github.com/kubeedge/kubeedge/edge/cmd/edgecore

go: github.com/kubeedge/viaduct@v0.0.0 requires
	github.com/cheekybits/genny@v0.0.0-20170328200008-9127e812e1e9: invalid version: git fetch --unshallow -f origin in /usr/lib/go/pkg/mod/cache/vcs/b329cdbcb3d2e4c2015b7b25337545381918119e36676dd2218aa51834697c6d: exit status 128:
	fatal: git fetch-pack: expected shallow list
make: *** [all] Error 1

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

5 participants