• Russ Cox's avatar
    go/build: invoke go command to find modules during Import, Context.Import · f8512534
    Russ Cox authored
    The introduction of modules has broken (intentionally) the rule
    that the source code for a package x/y/z is in GOPATH/src/x/y/z
    (or GOROOT/src/x/y/z). This breaks the code in go/build.Import,
    which uses that rule to find the directory for a package.
    
    In the long term, the fix is to move programs that load packages
    off of go/build and onto golang.org/x/tools/go/packages, which
    we hope will eventually become go/packages. That code invokes
    the go command to learn what it needs to know about where
    packages are.
    
    In the short term, though, there are lots of programs that use go/build
    and will not be able to find code in module dependencies.
    To help those programs, go/build now runs the go command to
    ask where a package's source code can be found, if it sees that
    modules are in use. (If modules are not in use, it falls back to the
    usual lookup code and does not invoke the go command, so that
    existing uses are unaffected and not slowed down.)
    
    Helps #24661.
    Fixes #26504.
    
    Change-Id: I0dac68854cf5011005c3b2272810245d81b7cc5a
    Reviewed-on: https://go-review.googlesource.com/125296Reviewed-by: 's avatarMichael Matloob <matloob@golang.org>
    Reviewed-by: 's avatarBryan C. Mills <bcmills@google.com>
    f8512534
Name
Last commit
Last update
..
ast Loading commit data...
build Loading commit data...
constant Loading commit data...
doc Loading commit data...
format Loading commit data...
importer Loading commit data...
internal Loading commit data...
parser Loading commit data...
printer Loading commit data...
scanner Loading commit data...
token Loading commit data...
types Loading commit data...