Open robshakir opened 4 years ago
Subsumes #208
Currently we are experiencing many build errors related to go_package
from running these generated proto files through the grpc_gateway
tool. Example errors:
> --openapiv2_out: unable to determine Go import path for "example.com/devicemanager/openconfig/enums/enums.proto"
>
> Please specify either:
> • a "go_package" option in the .proto source file, or
> • a "M" argument on the command line.
Do you have any ideas for workarounds prior to this functionality being enabled?
We actually already implemented this -- see https://github.com/openconfig/ygot/blob/a776802e8a810a2f41a9cd3a8bb567c800e16a51/docs/protobuf_getting_started.md
You can use the -go_package_name
flag to proto_generator
and it will add the relevant annotation.
HTH! r.
Thanks @robshakir. I was reading through the latest releases source and I don't see that flag defined in protogenerator.go
. In fact when I try it out, I get this error:
flag provided but not defined: -go_package_name
I'm using the v0.12.6 latest release. I'm sorry, but I must be missing something simple. Where is the flag -go_package_name
?
Hi Matt, the flag's name is -go_package_base
, the relative package path of the proto will be appended to it to form the go_package
name. See the first snippet in this heading: https://github.com/openconfig/ygot/blob/a776802e8a810a2f41a9cd3a8bb567c800e16a51/docs/protobuf_getting_started.md#generating-openconfig-bgp-rib-protobufs
Ah ok, understood. Thank you. Perhaps consider then updating the docs? I think there is a docs bug with a typo saying -go_package_name=
when you really mean -go_package_base=
.
Enhance the protobuf generation by adding:
optional
keyword for proto3.go_package
output in all proto files.