]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: set Root and target fields for packages in GOPATH
authorMichael Matloob <matloob@golang.org>
Tue, 7 Jun 2022 19:31:20 +0000 (15:31 -0400)
committerMichael Matloob <matloob@golang.org>
Wed, 8 Jun 2022 16:27:42 +0000 (16:27 +0000)
commitd65166024f3969289be5c74fd8be7d06a93264f1
tree8b6084e698a775b4264306772ea13f3cf3be5ffa
parent4afb0b9e533767f788252816c4b79ee29a1952a7
cmd/go: set Root and target fields for packages in GOPATH

This change replicates the behavior filed in issue #37015 for packages
imported from the module index. That behavior is that packages that
happen to exist in a GOPATH src directory have p.Root and p.Target set
even when the packages are loaded from modules. This is likely
unintentional behavior because in module mode, packages shouldn't behave
differently depending on whether their directories exist in GOPATH. But
for uniformity, (and because two of our tests depend on this behavior),
this CL will implement this behavior. We can remove it from the module
index when we remove it from the go/build logic.

Change-Id: I3f501c92fbb76eaf86b6b9275539f2129b67f884
Reviewed-on: https://go-review.googlesource.com/c/go/+/410822
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/go/internal/modindex/build.go
src/cmd/go/internal/modindex/read.go