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
go/build: Import doesn't work as expected with modules #31821
Comments
/cc @griesemer |
@griesemer can you look at this issue? I have a very simple repo case. Basically, if a package in a go module depends on a package that has a vendor directory, |
@dimes. Ok, will look at this next week. |
Thanks. I created a really simple example. Here is a package with a vendor directory: https://github.com/dimes/testtesttest You can repro this by creating a new Go module:
|
I cannot reproduce this issue. Here's what I have:
The
You are using More generally: The Please double-check your situation and reply. Thanks. |
Thanks @griesemer. I will try using |
@griesemer I just tried using
The error is the same. I think there is a weird interaction here when using Go modules. |
@griesemer sorry for the spam, but I believe I figured out the root cause of this issue. Inside of Checker.collectObjects, the imports are extracted from the files and then imported here: https://golang.org/src/go/types/resolver.go#L256 The issue seems to be that:
Is using
then it works. Not sure what the general solution to this is. |
@dimes Thanks for this analysis, that is very helpful. Looping in @bcmills who has been working on module support for additional input. (The |
Hi, Unless I'm misunderstanding this, this is an issue with The The I'm wondering if it would be okay to add a deprecation notice to |
@matloob Whatever is not working "as expected" in |
@dimes Please report back if you cannot get your code to work with |
In the meantime until we can figure out whether go/build as a whole can be deprecated, it seems safe to document that it's not supported for modules use cases. I'll send a CL to do that. |
@dimes |
Change https://golang.org/cl/183848 mentions this issue: |
Ok, great. Thanks for the help. Using the
|
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
I expected no error from
conf.Check
What did you see instead?
However, if from the command line, I run
go list -f '{{ .Dir }}' github.com/golang/protobuf/proto
I get/Users/maxgale/go/pkg/mod/github.com/golang/protobuf@v1.3.1/proto
. Another peculiarity is that the omitted packages are pulled from Github Enterprise repos.The text was updated successfully, but these errors were encountered: