-
Notifications
You must be signed in to change notification settings - Fork 198
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
gnmi_ext proto error when doing protoreflect #95
Comments
While looking, just curious what kind of file description information are you looking at? Will the existing one implemented by default (google.golang.org/protobuf/reflect/protoreflect) meet your requirement? e.g.
|
Hi Johnson, A better explanation of what we are facing In this case, it looks like gnmi_ext.proto was generated with 'protoc <opts...> proto/gnmi_ext/gnmi_ext.proto', as shown by the '// source: proto/gnmi_ext/gnmi_ext.proto' comment. This doesn't match the import in gnmi.proto, which is "github.com/openconfig/gnmi/proto/gnmi_ext/gnmi_ext.proto". [1] This dependency resolution is specific to the reflection library we use. |
Thanks for the context. Can you please share how did you generate the gnmi_ext.pb.go with the corrected relative path? |
Hi Johnson, protoc --proto_path=vendor/ --go_out=vendor/ github.com/openconfig/gnmi/proto/gnmi_ext/gnmi_ext.proto In your case I guess you'll have to do something like You should be able to verify by looking at this line in generated code and the file descriptor should become You may do the same for gnmi.proto as well I think but it isn't imported in any other proto I believe so it won't be necessary. |
I have updated the |
Looks good. Thanks for doing this quickly. |
the problem is not resolved in the latest version with reflection using grpurl to run gnmi.gNMI.Capabilities would result the following error
this issue is similar to: |
We are seeing issues with the way gnmi_ext.pb.go is generated from gnmi_ext.proto
When using https://github.com/jhump/protoreflect for doing reflection on gnmi, we are getting this error
File not found: github.com/openconfig/gnmi/proto/gnmi_ext/gnmi_ext.proto
Digging a little more we found that the file descriptor generated in gnmi_ext.pb.go
here at line 549
549 var File_proto_gnmi_ext_gnmi_ext_proto protoreflect.FileDescriptor
Has a relative path
21 // source: proto/gnmi_ext/gnmi_ext.proto
as indicated in line 21 of the file
While the golang import path is
github.com/openconfig/gnmi/proto/gnmi_ext/
as imported in github.com/openconfig/gnmi/proto/gnmi/gnmi.pb.go
It would be great if we can generate gnmi_ext.pb.go with relative path
github.com/openconfig/gnmi/proto/gnmi_ext/gnmi_ext.proto
instead of
proto/gnmi_ext/gnmi_ext.proto
We were able to test that the issue gets resolved by regenerating gnmi_ext.pb.go with the said relative path.
The text was updated successfully, but these errors were encountered: