aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/load.go
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2022-06-23 15:46:29 -0400
committerMichael Matloob <matloob@golang.org>2022-06-24 19:58:23 +0000
commit5a1c5b8ae741df2d5c53f328c57a84d85ae6c44a (patch)
tree04610416d799380dc6f26c0e655f6ca6b64b30db /src/cmd/go/internal/modload/load.go
parentb9c4d94fdbe0c9e11a1e604cf321614b90a1d882 (diff)
downloadgo-5a1c5b8ae741df2d5c53f328c57a84d85ae6c44a.tar.gz
go-5a1c5b8ae741df2d5c53f328c57a84d85ae6c44a.zip
cmd/go: add per-package indexing for modules outside mod cache
Packages outside the module cache including the standard library will be indexed individually rather than as a whole module. For #52876 Change-Id: I142dad6a790e9e8eb4dc6430a588fbfa86552e49 Reviewed-on: https://go-review.googlesource.com/c/go/+/413815 Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modload/load.go')
-rw-r--r--src/cmd/go/internal/modload/load.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index b2c3ba26339..ba85dc2438c 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -2102,8 +2102,8 @@ func (ld *loader) checkTidyCompatibility(ctx context.Context, rs *Requirements)
// may see these legacy imports. We drop them so that the module
// search does not look for modules to try to satisfy them.
func scanDir(modroot string, dir string, tags map[string]bool) (imports_, testImports []string, err error) {
- if mi, mierr := modindex.Get(modroot); mierr == nil {
- imports_, testImports, err = mi.ScanDir(mi.RelPath(dir), tags)
+ if ip, mierr := modindex.GetPackage(modroot, dir); mierr == nil {
+ imports_, testImports, err = ip.ScanDir(tags)
goto Happy
} else if !errors.Is(mierr, modindex.ErrNotIndexed) {
return nil, nil, mierr