mirror of
https://github.com/golang/go
synced 2024-11-26 19:41:19 -07:00
cmd/go: properly call PackageModuleRoot to get modroot for index
PackageModuleRoot needs to be called with the package's path, not its directory on disk. Change-Id: I080fe8ce2aeb72e1466624db81595a00915606bb Reviewed-on: https://go-review.googlesource.com/c/go/+/410820 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
d65166024f
commit
f862280e30
@ -871,7 +871,7 @@ func loadPackageData(ctx context.Context, path, parentPath, parentDir, parentRoo
|
|||||||
if !cfg.ModulesEnabled {
|
if !cfg.ModulesEnabled {
|
||||||
buildMode = build.ImportComment
|
buildMode = build.ImportComment
|
||||||
}
|
}
|
||||||
if modroot := modload.PackageModRoot(ctx, r.dir); modroot != "" {
|
if modroot := modload.PackageModRoot(ctx, r.path); modroot != "" {
|
||||||
if mi, err := modindex.Get(modroot); err == nil {
|
if mi, err := modindex.Get(modroot); err == nil {
|
||||||
data.p, data.err = mi.Import(cfg.BuildContext, mi.RelPath(r.dir), buildMode)
|
data.p, data.err = mi.Import(cfg.BuildContext, mi.RelPath(r.dir), buildMode)
|
||||||
goto Happy
|
goto Happy
|
||||||
|
Loading…
Reference in New Issue
Block a user