Skip to content
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

equal plugin generates wrong import line #283

Closed
andreimatei opened this issue Apr 12, 2017 · 7 comments
Closed

equal plugin generates wrong import line #283

andreimatei opened this issue Apr 12, 2017 · 7 comments

Comments

@andreimatei
Copy link

I've added the option (gogoproto.equal) = true; line to the following proto:
https://github.com/cockroachdb/cockroach/blob/befea82/pkg/roachpb/metadata.proto#L69

It seems to generate the following bogus import line:

import bytes "github.com/cockroachdb/bytes"

Not sure where it got the "cockroachdb/bytes" from; that package does not exist. The bytes types in the proto I've annotated are using gogoproto.casttype, which maybe is related.

@awalterschulze
Copy link
Member

Ok that looks like a bug. Well done.
I'll look into it asap.

@awalterschulze
Copy link
Member

I can't seem to reproduce.
I tried creating a message with a bytes field and a casttype.

Maybe it has something to do with your protoc command, like maybe using import_prefix?
Can you give me the protoc command or can you give me a smaller reproducing example?

@andreimatei
Copy link
Author

If you clone our repo, you can do make protobuf to do the code generation.
The protoc command seems to be:

/Users/andrei/work2/src/github.com/cockroachdb/cockroach/bin/protoc -I.:./cockroach/vendor/github.com/../github.com/gogo/protobuf:./cockroach/vendor/github.com/../github.com/gogo/protobuf/protobuf --cpp_out=lite:./cockroach/pkg/storage/engine ./cockroach/pkg/roachpb/data.proto ./cockroach/pkg/roachpb/internal.proto ./cockroach/pkg/roachpb/metadata.proto ./cockroach/pkg/storage/engine/enginepb/mvcc.proto ./cockroach/pkg/storage/engine/enginepb/rocksdb.proto ./cockroach/pkg/util/hlc/timestamp.proto ./cockroach/pkg/util/unresolved_addr.proto

It's indeed possible that it's something about our environment, but I can't think what it could be. If you don't get to it, I'll try a simpler repro.

@awalterschulze
Copy link
Member

It would really help to get a simpler example.

@andreimatei
Copy link
Author

It turns out that we're forced to fixup standard package imports with hacks because of the import_prefix we pass to protoc plugins.
https://github.com/cockroachdb/cockroach/blob/bf224cf/build/protobuf.mk#L87

@tamird, whom I believe you know, tells me that this is a known... idiosyncrasy with protoc.

Sorry for the noise.

@tamird
Copy link
Contributor

tamird commented Apr 13, 2017

Sounds like golang/protobuf#181.

@awalterschulze
Copy link
Member

No worries, this is a really hard issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants