Description
What version of protobuf and what language are you using?
Version: (e.g., v1.1.0
, 89a0c16f
, etc)
golang
protoc-gen-go
v1.36.0
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good with .proto
and .go
source code.
when generating a message with the following field names
syntax = "proto3";
option go_package="testproto/proto";
package fabric;
message Example {
optional string _wahoo = 1;
optional string X_wahoo = 2;
}
generation command
protoc --go_out=. --go_opt=paths=source_relative,default_api_level=API_HYBRID testprotos/proto/test.proto
What did you expect to see?
expected the following for generated getters (and the same for generated setters, has e.t.c) as was the case when generating without hybrid mode enabled.
OR
a failure in the compilation process.
func (x *ChatRequest) GetXWahoo() string {
if x != nil && x.XWahoo != nil {
return *x.XWahoo
}
return ""
}
func (x *ChatRequest) GetXWahoo_() string {
if x != nil && x.XWahoo_ != nil {
return *x.XWahoo_
}
return ""
}
What did you see instead?
generated Getters, Setter, Has e.t.c methods with identical method names for different fields
func (x *ChatRequest) GetXWahoo() string {
if x != nil && x.XWahoo != nil {
return *x.XWahoo
}
return ""
}
func (x *ChatRequest) GetXWahoo() string {
if x != nil && x.XWahoo_ != nil {
return *x.XWahoo_
}
return ""
}
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment?
example taken from testprotos dir for custom plugins so field naming outside of the dir does not follow the same naming pattern.
command
protoc --go_out=. --go_opt=paths=source_relative,default_api_level=API_HYBRID testprotos/proto/test.proto