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

docs reference nonexistent flag #1328

Closed
kevinburke1 opened this issue Jun 4, 2021 · 6 comments
Closed

docs reference nonexistent flag #1328

kevinburke1 opened this issue Jun 4, 2021 · 6 comments

Comments

@kevinburke1
Copy link

This page: https://developers.google.com/protocol-buffers/docs/reference/go-generated

makes several references to a "go_opt" flag, which as far as I can tell, does not exist with the latest installed protoc version.

@neild
Copy link
Contributor

neild commented Jun 4, 2021

You most likely have an older version of protoc installed. The most recent version is v3.17.2. You can check the version you are using with protoc --version.

@kevinburke1
Copy link
Author

I just updated to 3.17.2 and here's what I get:

$ protoc --version
libprotoc 3.17.2
$ protoc -I. --go_opt=Mgoogle/protobuf/field_mask.proto=github.com/google/go-genproto/protobuf/field_mask,plugins=grpc:./ ./google_libphonenumber/resources/*.proto
Unknown flag: --go_opt

@kevinburke1
Copy link
Author

Ah, okay, I can get a different error message if I also specify the "--go_out" flag. I guess that's pretty confusing behavior.

Now I need to figure out how to get the import path to work, I'm trying the "M" flag from the docs and it's not working.

@neild
Copy link
Contributor

neild commented Jun 4, 2021

Ah, looks like protoc only kind of has a --foo_opt flag if you also specify --foo_out. Yep, that's super confusing.

You shouldn't need to specify a M flag for field_mask.proto. It looks like libphonenumber doesn't have go_package options in its .proto files, however, so you'll need something like:

--go_opt=Mgoogle_libphonenumber/resources/phonenumber.proto=<import path here>
--go_opt=Mgoogle_libphonenumber/resources/phonemetadata.proto=<import path here>
--go_opt=plugins=grpc # Although I strongly recommend using the latest go-grpc plugin and --go-grpc_out=... instead.
--go_out=<output here>

@kevinburke1
Copy link
Author

Thanks for the help - I ended up getting it sorted out here, ttacon/libphonenumber#107

@neild neild closed this as completed Jun 5, 2021
@LordMoMA
Copy link

Sorry, may I know why you fix "Unknown flag: --go_opt"? I tried almost every method available but in vain.

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

3 participants