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 […]/v2@v2.X.Y' fails when the repo root contains the go.mod file for […]/v2 but no .go source files #34746

Closed
bcmills opened this issue Oct 7, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented Oct 7, 2019

My fix for #34383 was incomplete: it failed to take into account the possibility that the longest path for the module would be a *PackageNotInModuleError, in which case we should prefer the *PackageNotInModuleError over an unclassified error from a module with a shorter path.

A reproducer:

example.com$ gotip version
go version devel +cfe23204 Sun Oct 6 18:18:50 2019 +0000 linux/amd64

example.com$ GOPROXY=direct gotip get vcs-test.golang.org/git/empty-v2-without-v1.git/v2@v2.0.0
go: finding vcs-test.golang.org/git/empty-v2-without-v1.git v2.0.0
go get vcs-test.golang.org/git/empty-v2-without-v1.git/v2@v2.0.0: vcs-test.golang.org/git/empty-v2-without-v1.git@v2.0.0: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2

CC @jayconrod

@bcmills bcmills added this to the Go1.14 milestone Oct 7, 2019
@bcmills bcmills self-assigned this Oct 7, 2019
@bcmills

This comment has been minimized.

Copy link
Member Author

@bcmills bcmills commented Oct 7, 2019

@gopherbot, please backport to 1.13. This was a regression, and the fix goes with #34497 (already backported).

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 7, 2019

Backport issue(s) opened: #34747 (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.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 8, 2019

Change https://golang.org/cl/199839 mentions this issue: cmd/go: suppress more errors in package-to-module loading

@gopherbot gopherbot closed this in 421d35c Oct 9, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 9, 2019

Change https://golang.org/cl/199997 mentions this issue: [release-branch.go1.13] cmd/go: suppress more errors in package-to-module loading

gopherbot pushed a commit that referenced this issue Oct 9, 2019
…dule loading

In CL 197059, I suppressed errors if the target package was already found.
However, that does not cover the case of passing a '/v2' module path to
'go get' when the module does not contain a package at its root.

This CL is a minimal fix for that case, intended to be backportable to 1.13.

(Longer term, I intend to rework the version-validation check to treat
all mismatched paths as ErrNotExist.)

Updates #34746
Fixes #34747

Change-Id: Ia963c2ea00fae424812b8f46a4d6c2c668252147
Reviewed-on: https://go-review.googlesource.com/c/go/+/199839
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 421d35c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/199997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.