Skip to content
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

[protobuf-go] How to access field extensions. #1528

Open
marwan-at-work opened this issue Mar 7, 2023 · 1 comment
Open

[protobuf-go] How to access field extensions. #1528

marwan-at-work opened this issue Mar 7, 2023 · 1 comment

Comments

@marwan-at-work
Copy link

Hi there, I have the following protobuf file:

syntax = "proto3";
package example;
option go_package = "...";
import "options.proto";

message MyMessage {
  string ID = 1 [(optionspkg.name) = "id"];
}

And I am writing a plugin in protobuf-go using protogen.

My question is: how can I access options.pkg.name and its value "id" from *protogen.Field?

It seems that I can call field.Desc.Options() which does return *descriptorpb.FieldOptions which has the options in an unexported field : extensionFields protoimpl.ExtensionFields so I'm unable to access it.

Thanks!

@marwan-at-work
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant