]> Cypherpunks repositories - gostls13.git/commit
cmd/go: fix 'go test' and 'go fmt' with files outside a module
authorBryan C. Mills <bcmills@google.com>
Mon, 10 Dec 2018 20:02:38 +0000 (15:02 -0500)
committerBryan C. Mills <bcmills@google.com>
Tue, 11 Dec 2018 21:45:00 +0000 (21:45 +0000)
commitcee9dfc39bef7b53ffa4ee584ec7fdec03c95a5a
tree90a01e40cba0b4b45cf567a75cc7f8f73c6abfd3
parent353ebe721019ac833646bea829d7840e55f3da30
cmd/go: fix 'go test' and 'go fmt' with files outside a module

Use the actual loader result in findModule instead of making
assumptions about nesting in the build list.
As a side-effect, this produces much clearer error messages for
packages that (for one reason or another) failed to load.

Adjust the package and module path outside a module to
"command-line-arguments". That string already appears in the output of
a number of (module-mode and GOPATH-mode) commands for file arguments,
and as far as I can tell operation outside a module is currently the
only case in which the module path of a package is not actually a
prefix of the import path.

Fixes #28011
Fixes #27099
Fixes #28943
Updates #27102
Updates #28459
Updates #27063

Change-Id: I61d5556df7b1b7d1efdaffa892f0e3e95b612d87
Reviewed-on: https://go-review.googlesource.com/c/153459
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/modload/build.go
src/cmd/go/internal/modload/init.go
src/cmd/go/testdata/script/mod_enabled.txt
src/cmd/go/testdata/script/mod_get_svn.txt
src/cmd/go/testdata/script/mod_outside.txt
src/cmd/go/testdata/script/mod_test_files.txt [new file with mode: 0644]