Closed jon-whit closed 2 years ago
I think you just need to add the ;echov1
element to the end of your GO_PACKAGE
override.
managed:
enabled: true
go_package_prefix:
default: github.com/myorg/privateapi/proto
override:
GO_PACKAGE:
echo/v1/echo_service.proto: "go.buf.build/myorg/go/myorg/publicapi/echo/v1;echov1"
This follows the implementation that we have internally for composing the go_package
value (link). This is discussed in the Protobuf documentation, too (link).
I'll close this, but please feel free to re-open if that doesn't actually solve your issue!
I have two different buf modules (one private and one public). The private module acts as a proxy to the public module . The private module defines the same RPC API surface as the public one. I'm using
managed
mode, and I want the Go protobuf generated sources (including the grpc-gateway and other plugins) to reference the Go module for the publicly generated sources instead of using thego_package_prefix
default for the public (external) Go module import. I'm having issues getting buf to do this for me.I've read the following resources to try and get more knowledge:
override
keywordThis sounds like what I'm trying to do as well, but I'm struggling to get it to work.
Sample code:
I have a
buf.yaml
andbuf.gen.yaml
for the private module that looks like this:If I
buf generate
with the configurations above, then I get code generated from thegrpc-gateway
plugin that looks like this:What's the proper way to mix private and public modules like this in a way that works with this usage pattern? I want my private generated Go sources to references the publicly hosted Go module (from the Buf Registry).