-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Currently the generated *.orion.pb.go file needs to be placed as a sibling to the generated protobufs, because the orion file references an unexported variable:
Orion/protoc-gen-orion/orion.go
Line 262 in ec021a7
serviceDescVar := "_" + servName + "_serviceDesc" |
In later versions of protoc-gen-go-grpc, this variable is now exported. #171 is a related issue to allow protoc-gen-orion to use the exported variable.
The variable being exported now also means that it should be possible to place the *.orion.pb.go file in a separate package. In Carousell we're considering having a Go module for all generated protobufs, and another module for all generated orion *.orion.pb.go files.
Ideally the module for generated protobufs will only contain two dependencies:
github.com/golang/protobuf
google.golang.org/grpc
Having the orion files as a sibling will require github.com/carousell/Orion
to be added as another dependency. The orion dependency is too heavy for us to include. Not every service that consumes our generated protobufs will need Orion.
Thus ideally the orion file will live in a separate package. Example file structure:
gen/
go/
serviceA/serviceA.pb.go
serviceB/serviceB.pb.go
go.mod
orion/
serviceA/serviceB.orion.pb.go
go.mod
I have some ideas of how to extend protoc-gen-orion to support this. I'll add more comments to the issue later.