Closed EricRabil closed 1 year ago
We’ve discussed this matter before recently.
I would recommend instead to introduce a method by a different name which encodes your specific use, c.f. GoString() string
.
As an aside, note that you cannot add or override receiver methods on type aliases. You would have to instead use an embedded struct.
Is your feature request related to a problem? Please describe. I have a message/struct I am trying to integrate into an existing codebase:
This message already has an established stringified value
{{Service}};{{IsGroup ? + : -}};{{LocalID}}
value which I would like to implement in a sidecar file within the same generated package. However, this generator does not have any mechanism to influence which helper methods are/are not generated.Describe the solution you'd like I would like to be able to specify, either by command line or annotation within the proto file, that specific methods on specific messages should not be generated.
Describe alternatives you've considered Writing a typealias against
IPCGUID
and shadowing theString()
method is an alternative, this introduces nuances in howIPCGUID
andAliasedIPCGUID
can be interchanged, and makes protobuf less useful.An alternative solution would be the ability to generate the String method in a way where it cannot be called, signaling developers to use the correct stringifier.