golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.66k stars 1.58k forks source link

Golang - oneof field creates m receiver instead of x #1500

Open ivanjaros opened 1 year ago

ivanjaros commented 1 year ago

What version of protobuf and what language are you using? go version go1.19 windows/amd64 libprotoc 3.19.1 google.golang.org/genproto v0.0.0-20220930163606-c98284e70a91 google.golang.org/protobuf v1.28.1

What did you do? I have added oneof field into proto definition

What did you expect to see? Oneof method to have x receiver.

What did you see instead? Oneof method has m receiver.

puellanivis commented 1 year ago
func (m *Value) GetKind() isValue_Kind

vs.

func (x *Value) GetNullValue() NullValue

🤔 This is really only a linty sort of thing, and usually one does not run lint on autogenerated code. It’s something we could correct, as the consistency would be nice. But as I said, this would not change any of the behavior of the generated code.

PS: if you want to propose a PR through Gerrit, this would be the fastest way towards a fix