Closed
Description
Take this generated code:
type FlagId struct {
Deployment *DeploymentId `protobuf:"bytes,1,opt,name=deployment" json:"deployment,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
}
func (m *FlagId) Reset() { *m = FlagId{} }
func (m *FlagId) String() string { return proto.CompactTextString(m) }
func (*FlagId) ProtoMessage() {}
func (m *FlagId) GetDeployment() *DeploymentId {
if m != nil {
return m.Deployment
}
return nil
}
What is the purpose of this Getter? It will not be called on a nil
m *FlagId
.
I actually hoped it would create an new instance of the type behind the Deployment
field, but it seems to not do anything other than a normal m.Deployment
would.
I really hoped it would create a new instance if it was nil, this way I could solve the problem in without reflection:
grpc-ecosystem/grpc-gateway#32
Metadata
Assignees
Labels
No labels