]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.13] cmd/go: fix listing of ambiguous paths
authorDuco van Amstel <duco.vanamstel@gmail.com>
Fri, 4 Oct 2019 13:05:13 +0000 (13:05 +0000)
committerBryan C. Mills <bcmills@google.com>
Mon, 7 Oct 2019 16:43:16 +0000 (16:43 +0000)
commit2f73eedd42b509e3aa262fb2846105d3b5cee986
treebd9cf5ad7e8fb67b7eedd9ab259c377fada23722
parentb7b6e8e294d620477bd0266f199e633fcd57662d
[release-branch.go1.13] cmd/go: fix listing of ambiguous paths

Passing ambiguous patterns, ending in `.go`, to `go list` results in them
being interpreted as Go files despite potentially being package references.
This can then result in errors on other package references.

The parsing logic is modified to check for a locally present file
corresponding to any pattern ending in `.go`. If no such file is present
the pattern is considered to be a package reference.

We're also adding a variety of non-regression tests that fail with the
original parsing code but passes after applying the fix.

Updates #34653
Fixes #34694

Change-Id: I073871da0dfc5641a359643f95ac14608fdca09b
GitHub-Last-Rev: 5abc200103ffc122df05422d79cf30c3ba0ee646
GitHub-Pull-Request: golang/go#34663
Reviewed-on: https://go-review.googlesource.com/c/go/+/198459
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit 33683f1d64df0cef2c598a84b741abb5af8abe5e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/198957
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/modget/get.go
src/cmd/go/testdata/script/list_ambiguous_path.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_get_trailing_slash.txt