The AllowVendor logic in (*build.Context).Import checks for a directory called vendor/a/b when importing a package "a/b". If only package "a/b/c" was vendored, the directory a/b must exist but will be empty, causing Import not to find the real (unvendored) package.
Import should check for non-empty directories. This logic differs from the usual (non-vendored) case.
The text was updated successfully, but these errors were encountered:
If there is a source directory d/vendor, then, when compiling a source file within the subtree rooted at d, import "p" is interpreted as import "d/vendor/p" if that exists.
But obviously that's not good enough. I'm surprised this is the first we've noticed this. I can't decide if that's good.
The a/b directory in your example is non-empty: it contains c. It's not entirely clear what to do. I guess if there are no .go files at all (not even ones with exclusionary build tags) then we could ignore the directory. I'll try that.
@alandonovan, how does that work? Doesn't a/b contain a/b/c? Am I misunderstanding what readDir does? It looks like it calls ioutil.ReadDir. Maybe you overrided the default with a broken ctxt.ReadDir function set that doesn't return subdirectories?