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: 'get xxx@latest' does not report mismatch between module path and major version #30499

Open
XuHuaiyu opened this issue Mar 1, 2019 · 5 comments

Comments

Projects
None yet
8 participants
@XuHuaiyu
Copy link

commented Mar 1, 2019

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

$ go version
go version go1.12 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
GOARCH="amd64"
GOBIN="/Users/xuhuaiyu/Development/GOPATH/bin"
GOCACHE="/Users/xuhuaiyu/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xuhuaiyu/Desktop/gopath"
GOPROXY=""
GORACE=""
GOROOT="/Users/xuhuaiyu/.gvm/gos/go1.12"
GOTMPDIR=""
GOTOOLDIR="/Users/xuhuaiyu/.gvm/gos/go1.12/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/xuhuaiyu/Desktop/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/ck/7tvksj1s7cl6djwl1j6kd67m0000gn/T/go-build099338216=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ GO111MODULE=on go get github.com/pingcap/tidb@latest

What did you expect to see?

github.com/pingcap/tidb v2.1.5

What did you see instead?

go: extracting github.com/pingcap/tidb v2.0.11+incompatible

@XuHuaiyu XuHuaiyu changed the title GO111MODULE=on go get github.com/pingcap/tidb@latest does not get the latest version go get xxx@latest does not get the latest version Mar 1, 2019

@XuHuaiyu XuHuaiyu changed the title go get xxx@latest does not get the latest version go get xxx@latest does not get the latest tag Mar 1, 2019

@oiooj oiooj added the modules label Mar 1, 2019

@agnivade agnivade changed the title go get xxx@latest does not get the latest tag cmd/go: get xxx@latest does not get the latest tag Mar 1, 2019

@agnivade agnivade added this to the Go1.13 milestone Mar 1, 2019

@agnivade

This comment has been minimized.

Copy link
Member

commented Mar 1, 2019

/cc @bcmills

@rleungx

This comment has been minimized.

Copy link

commented Mar 1, 2019

It seems that the behaviors between v2.0.x and v2.1.x are different. The v2.0.x will get a missing type, but v2.1.x will get a blob type. I'm not sure if it is expected.
https://github.com/golang/go/blob/master/src/cmd/go/internal/modfetch/codehost/git.go#L624

@justinruggles

This comment has been minimized.

Copy link

commented Mar 3, 2019

I believe the issue is that the tidb module name does not include the /v2 to indicate major version 2

@bcmills bcmills changed the title cmd/go: get xxx@latest does not get the latest tag cmd/go: 'get xxx@latest' does not report mismatch between module path and major version Mar 28, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Mar 28, 2019

@justinruggles has the right root cause, but we could certainly do a better job of diagnosing the problem.

CC @jayconrod

@jayconrod

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2019

go release (#26420) will warn module authors about this before tagging new versions. I think that's the main solution for this.

go get could print a warning here for the latest semantic version if it has a go.mod file with a module path that doesn't match the semantic version.

In most cases though, when authors add go.mod files after a v2 version, they'll use a /v2 suffix. We shouldn't print an error message for that when looking for the latest version of the module without a suffix.

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.