/ go Public
cmd/go: Go build doesn't disable import path checking in vendor trees when using GOPATH #51243
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
Does this issue reproduce with the latest release?
Yes, tested with 1.17.6 and I haven't seen any changes to this code in later release tags
What operating system and processor architecture are you using (
What did you do?
Since GOPATH is still supported in this version, we can make a new package in the src folder of gopath and setup vendoring for external dependencies:
main.go; import the vendor path for the package we want to include in the main file:
./vendor/github.com/fakeusr/fakepkg/fake.go; specify an "import comment" to enforce import path checking in external dependency:
Try building the package:
What did you expect to see?
The package builds successfully because import path checking should be ignored in vendor trees:
Tested with older versions of go (such as 1.10) and this package builds successfully
What did you see instead?
Lines 906 to 910 in 9de1ac6
We can see it's supposed to ignore import path checking when the path is inside the vendor tree BUT it's using the unresolved (unexpanded path to the vendor folder) so it doesn't realize that the code is actually in a vendor folder. It seems that this was introduced when the change was made to parallelize package loading.
The text was updated successfully, but these errors were encountered: