• Bryan C. Mills's avatar
    cmd/go/internal: factor out modload.QueryPackage and use in in modget · 261609f6
    Bryan C. Mills authored
    modload.Import contains a loop that looks for the module containing a package.
    Because we overload Import to locate both packages and modules, that loop
    contains a bunch of special-cases for modules with empty roots.
    
    In this change, we factor out the loop into a new function (QueryPackage) and
    use that directly in modget.getQuery. That restores the invariant that
    the paths passed to modload.Import must be importable packages, and fixes 'go
    get' lookups for packages that have moved between a module and submodules with
    the same path prefix.
    
    Updates #26602.
    
    Change-Id: I8bc8340c17f2df062d03ce720f4dc18b2ba406b2
    Reviewed-on: https://go-review.googlesource.com/128136Reviewed-by: default avatarRuss Cox <rsc@golang.org>
    261609f6
mod_get_local.txt 1.59 KB