New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: 'go list' in module mode reports GOPATH Root and Target fields when the main module is in GOPATH/src #37015
Comments
Hmm, interesting. In a module root outside of
And However, in a module contained within
So it appears that we are still computing (and using) the |
Change https://go.dev/cl/410822 mentions this issue: |
I think we should follow the |
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>
Change https://go.dev/cl/414055 mentions this issue: |
Non-main packages in module mode should not be installed to GOPATH/pkg, but due to #37015 they were installed there anyway. This change switches the 'go install' command to instead use 'go build -buildmode=archive' with an explicit archive path. For #37015. Change-Id: Ib0c8f213100b6473a7657af96f31395703e28493 Reviewed-on: https://go-review.googlesource.com/c/go/+/414055 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
From inside a module root directory, where
pkg
is a non main package.What did you expect to see?
An empty
Target
, since withGO111MODULE=on
the package archives are no more installed in$GOPATH
.What did you see instead?
NOTE: if it is decided that
Target
will be left empty, I hope thatRoot
will remain.The text was updated successfully, but these errors were encountered: