Is there a list of all the `--go_opt` and `--go-grpc_opt` options
i'm working on a tool which provide shell suggestion for protoc and I would like to know if there is a list of all the options for the two flags.
I've use module in the past, such as:
protoc -I. --go_out=. --grpc_out=. --go_opt=module=... --go-grpc_opt=module=... *.proto
And I cannot seem to find where these options are defined and handled. Could you please guide me ?
2 years and no answer. Excellent 😂
I forgot to follow up but I found the list of default options for --go_opt. It can be found in the here (the New function in protobuf-go/compiler/protogen/protogen.go).
Here is the list:
moduleorMfollowed by the go module path.pathsthat can take "import" or "source_relative" as value.annotate_codethat can take true or false as value.
As for --go-grpc_opt I'm not sure yet but I'll try to keep this issue updated.
https://protobuf.dev/reference/go/go-generated/#invocation documents Go code generator flags.
(I don't think the annotate_code option is documented, but it's also incredibly specialized and you almost certainly don't care about it unless you're trying to write an LSP implementation for protobufs or something.)
The gRPC generator should accept the same flags, in addition to any gRPC-specific ones. I'm not sure where the gRPC generator documentation is.
Is annotate_code emitting SourceCodeInfo or something like this? I'm actually working on some libraries that are meant to build an LSP, so I'm still interested 😊
annotate_code emits a .meta file alongside each .pb.go containing a GeneratedCodeInfo. (See descriptor.proto for the definition.) Where SourceCodeInfo is created by protoc and describes the relationship between a .proto source file and the descriptors in it, GeneratedCodeInfo describes the relationship between the generated code and the .proto source.