-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Generate .pb.go files with absolute import paths. #895
Comments
Actually, |
I'm not sure what this means. Do you intend for a single |
If we use absolute paths in the go_package the files are written with the git tree as We use go modules so we aren't using the Go workspace layout for our project. |
Is #748 perhaps something that more accurately resolves your issue? |
Is there any documentation on these flags? I tried to grok what source_relative does but I couldn't figure it out. |
https://github.com/golang/protobuf#packages-and-input-paths EDIT: Given that |
To start with, set
Setting the The next question is what
Neither of these is exactly what you want, which is The simplest thing for you to do is probably to pick one of the above options, generate the file into a temporary directory, and copy it into the desired location. |
(going to close this, but please reopen if this doesn't answer the question) |
Hello, Pre-requisites
How this solves your problemThis
ExampleAssuming you have a Thus, the CaveatThe caveat here is that you cannot use wildcards to specify an entire directory package, like HoweverDespite these, the I hope this answer will be useful to many ! |
We use go modules and we have proto files that can live in 1 of the 2 directories,
pkg/pb
orinternal/pb
. We want theinternal/pb
proto files to reference thepkg/pb
files that are emitted fromprotoc-gen-go
andprotoc
.Is it possible to do this? The problem right now is the
internal/pb
files are generated under the assumption that thepkg/pb
files live in the same directory which causes compile issues.We fixed this by sed replacing the
pkg/pb
withopen-match.dev/open-match/pkg/pb
in the files, https://github.com/googleforgames/open-match/blob/master/Makefile#L727.Example pkg/pb
https://github.com/googleforgames/open-match/blob/master/api/backend.proto
https://github.com/googleforgames/open-match/blob/master/pkg/pb/backend.pb.go
Example internal/pb
https://github.com/googleforgames/open-match/blob/master/api/synchronizer.proto
https://github.com/googleforgames/open-match/blob/master/internal/pb/synchronizer.pb.go
The text was updated successfully, but these errors were encountered: