[Go] Replace references to hardcoded ”Monster" etc with idiomatic go wherever possible#5716
Conversation
See discussion at google#5668
Similar to discussion google#5668 But signature: ``` func AnyUnPack(t Any, table flatbuffers.Table) *AnyT ``` Becomes, ``` func (rcv Any) UnPack(table flatbuffers.Table) *AnyT ```
Let's also deprecate the generated
|
|
LGTM, i like this flatbuffers.GetRootAs() |
|
The I have a code base which does a lot of RPC handling with flatbuffers. Since golang does not have With the global I would have to do this for all RPC handler functions, which bloats the code a lot. |
|
Another idea is that we can create a |
|
Without loss of generality, I'm hereinafter referring to the local name of generated artifact as "monster"
I have been thinking about this deeper and I have just now realized that all the As such, I now think we ought to be following the golang convention on naming for this constructor. So perhaps See the following for reference on this convention:
So perhaps the "Monster" in the the identifier for this function needn't be eliminated after all. |
I will go ahead and add this to this PR |
|
I guess for the moment keep both ways of getting the root, maybe mark the old as deprecated somehow? |
|
I'm generally ok with this PR, hopefully we don't break too many people. |
|
Sorry, I'd also like the generated I did not achieve this in the current PR as it stands.. But just now thought of how to do this. watch this space, I'll update the PR. |
|
This LGTM. Thanks for keeping the PR scoped to just the Object API, it made it easier to review. |
|
Ok, thanks! |
|
oh no, there still some changes to this PR I had.. I guess I'll make a new one |
|
@somombo We do that sometimes... best to state in big loud letters that you want to keep tweaking it. :-] |
|
@rw Noted! watch out for go.mod next |
Most details of the need for this PR were already discussed in Issue #5668.
I have also (additionally) converted the generated union types' UnPack func into a method.
e.g.
Generated func:
Becomes method,