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" fails on import path patterns with wildcards ("...") [1.11 backport] #29248

Closed
gopherbot opened this issue Dec 14, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@gopherbot
Copy link

commented Dec 14, 2018

@bcmills requested issue #29241 to be considered for backport to the next 1.11 minor release.

@gopherbot, please backport to 1.11 and 1.10 immediately: this is a major regression.

@gopherbot

This comment has been minimized.

Copy link
Author

commented Dec 14, 2018

Change https://golang.org/cl/154110 mentions this issue: cmd/go/internal/get: move wildcard-trimming to before CheckImportPath

@gopherbot

This comment has been minimized.

Copy link
Author

commented Dec 14, 2018

Closed by merging ef209c9 to release-branch.go1.11.

@gopherbot gopherbot closed this Dec 14, 2018

gopherbot pushed a commit that referenced this issue Dec 14, 2018

[release-branch.go1.11] cmd/go/internal/get: move wildcard-trimming t…
…o before CheckImportPath

Previously, RepoRootForImportPath trimmed certain "..." wildcards from
package patterns (even though its name suggests that the argument must
be an actual import path). It trimmed at the first path element that
was literally "..." (although wildcards in general may appear within a
larger path element), and relied on a subsequent check in
RepoRootForImportPath to catch confusing resolutions.

However, that causes 'go get' with wildcard patterns in fresh paths to
fail as of CL 154101: a wildcard pattern is not a valid import path,
and fails the path check. (The existing Test{Vendor,Go}Get* packages
in go_test.go and vendor_test.go catch the failure, but they are all
skipped when the "-short" flag is set — including in all.bash — and we
had forgotten to run them separately.)

We now trim the path before any element that contains a wildcard, and
perform the path check (and repo resolution) on only that prefix. It
is possible that the expanded path after fetching the repo will be
invalid, but a repository can contain directories that are not valid
import paths in general anyway.

Fixes #29248

Change-Id: I70fb2f7fc6603b7d339fd6c02e8cdeacfc93fc4b
Reviewed-on: https://go-review.googlesource.com/c/154108
Reviewed-by: Russ Cox <rsc@golang.org>
(cherry picked from commit 47fb1fb)
Reviewed-on: https://go-review.googlesource.com/c/154110
Reviewed-by: Filippo Valsorda <filippo@golang.org>
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.