-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
I have an issue with vendoring when placed on $GOPATH/src/vendor and "vendored" file use Import Path Checking.
$GOPATH
.
└── src
├── main
│ └── main.go
└── vendor
└── vnd.org
└── a
└── a.go
with main.go :
package main
import _ "vnd.org/a"
func main() {}
and a.go :
package a // import "vnd.org/a"
go build throw many errors like this :
main.go:3:8: code in directory /[...]/src/vendor/vnd.org/a expects import "vnd.org/a"
According to the spec : "Code inside vendor/ subtrees is not subject to import path checking.".
However import path checking is not properly disabled if the vendored package is at the root of GOPATH since the package name doesn't contain "/vendor/" but starts with "vendor/"
The fix looks easy enough ( replace the condition in file cmd/go/pkg.go
line 371 with (!go15VendorExperiment || (!strings.Contains(path, "/vendor/") && !strings.HasPrefix(path, "vendor/")))
), I can submit a pull request if necessary.