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: vendoring fail when put on $GOPATH root with Import Path Checking #12232
Comments
Putting a We should probably disallow it. |
This bug make it impossible to locally vendor many |
cc @davecheney |
I don't see anything wrong with putting a vendor directory at the root of a workspace directory (eg if the intended usage is to make use of external tools to manage this part of the code). In this particular case, the fix looks also especially obvious and in line with the rest of the code (see switch {
case strings.Contains(path, "/vendor/"):
return strings.LastIndex(path, "/vendor/") + 1, true
case strings.HasPrefix(path, "vendor/"):
return 0, true
} |
CL https://golang.org/cl/13924 mentions this issue. |
Can someone explain the use case for |
yea, this sounds strange to me too.. sounds like its useful when doing $GOPATH rewriting for project workspaces...? I personally wish for |
@pkieltyka why have those subdirectories inside |
@mattfarina I'd like to see src/ and pkg/ in the vendor/ of my project so I could use vendor/ dependencies for development. In order to use them for development, I need the pkg/ folder so that the vendored deps won't be rebuilt each time. With vendor/pkg, I can keep doing incremental builds of my project and its deps which is essential for keeping development productive. |
@pkieltyka Try going into your |
I guess |
Marking this as 1.5.1 so that we can make a decision on whether to include it. I can't tell whether this is a real bug or not. If it's a real bug, it's new in 1.5, so fixing it in 1.5.1 is not entirely out of bounds. |
lol.. all that discussion for a 1 line fix.. nice :) thanks guys |
CL https://golang.org/cl/14228 mentions this issue. |
…ndored packages rooted at GOPATH Fixes #12232. Change-Id: Ide3fb7f5fc5ae377ae8683fbb94fd0dc01480549 Reviewed-on: https://go-review.googlesource.com/13924 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-on: https://go-review.googlesource.com/14228 Reviewed-by: Ian Lance Taylor <iant@golang.org>
I have an issue with vendoring when placed on $GOPATH/src/vendor and "vendored" file use Import Path Checking.
with main.go :
and a.go :
go build throw many errors like this :
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.The text was updated successfully, but these errors were encountered: