-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: module loader fails to resolve imports within symlinked source file #28107
Comments
Thanks for the straightforward reproducer. The problem seems to be the
|
Change https://golang.org/cl/141097 mentions this issue: |
@bcmills I'm not too certain on the cause of this, but broadly speaking, shouldn't the fix involve resolving fewer symlinks, not more? |
Nope. The bug turned out to be in how we detect whether an entry within the package directory is a file or a directory: in order to do that for a symlink, we have to first resolve it. |
👍 |
Change https://golang.org/cl/163517 mentions this issue: |
info.Name returns a name relative to the directory, so we need to prefix that directory in the Stat call. (This was missed in CL 141097 due to the fact that the test only happened to check symlinks in the current directory.) This allows the misc/ tests to work in module mode on platforms that support symlinks. Updates #30228 Updates #28107 Change-Id: Ie31836382df0cbd7d203b7a8b637c4743d68b6f3 Reviewed-on: https://go-review.googlesource.com/c/163517 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
@gopherbot please open a backport to 1.12. This is a low risk patch that has enough benefits to warrant a cherrypick. |
Backport issue(s) opened: #31763 (for 1.12). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/175441 mentions this issue: |
… resolve symlinks info.Name returns a name relative to the directory, so we need to prefix that directory in the Stat call. (This was missed in CL 141097 due to the fact that the test only happened to check symlinks in the current directory.) This allows the misc/ tests to work in module mode on platforms that support symlinks. Updates #30228 Updates #28107 Fixes #31763 Change-Id: Ie31836382df0cbd7d203b7a8b637c4743d68b6f3 Reviewed-on: https://go-review.googlesource.com/c/163517 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/175441 Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This succeeds:
However, this fails:
It seems like go's module system might be trying to resolve things relative to the symlink target and not the actual symlink, which makes all sorts of nice overlay arrangements impossible unless you either hardlink (ew) or copy (yuck).
Here's a full sequence to reproduce
The text was updated successfully, but these errors were encountered: