-
Notifications
You must be signed in to change notification settings - Fork 278
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
include_imports does not respect 'strategy: directory' #3056
Comments
Thank you for providing a clear example. In the use-case of Twirp, specifically, is there a reason why you would need That being said, the behaviour outlined here is a valid UX difference between |
Thanks for the detailed issue here. I'll try to explain what is happening here, and why I think this may be a documentation issue on our part - in effect,
In The equivalent in
Not sure if this answer is satisfying or makes sense, but the short of it:
|
Hey!
Yeah, so the setup is a bit non-standard because it's a monorepo with multiple independent projects, but a shared proto/ directory. Roughly like this:
I'm trying to set it up so that each project can have its own copy of the generated code that it cares about by having each project have its own buf.gen.yaml. (The projects cannot share the generated code because they're separate Go modules.)
buf.gen.yamlversion: v2
managed:
enabled: true
override:
- file_option: go_package_prefix
value: example.com/proj2/gen/go
plugins:
- local: protoc-gen-go
out: pb
opt: paths=source_relative
include_imports: true
- local: protoc-gen-twirp
out: pb
opt: paths=source_relative
include_imports: true
inputs:
- directory: ..
paths:
- ../proto/proj2 So
I want to clarify that the issue isn't that the information about the imported protos is present, but that the imported .proto is in the set of files that it requested codegen for. |
Ah. So that part is intended behavior. |
Talked offline: it turns out we sctually should make |
GitHub Repository
https://github.com/abhinav/buf-include_imports-strategy-repro
Commands
Output
Expected Output
Anything else?
I wrote a minimal plugin in the reproduction repo that just logs the files to generate to demonstrate the problem.
I'm using the latest release of Buf as of writing this.
The only workaround right now is to manually list imports in the
inputs
section.Without this, old plugins like Twirp explode during package name resolution.
The text was updated successfully, but these errors were encountered: