[Go] Replace references to hardcoded ”Monster" etc with idiomatic go wherever possible (#5716)

* go: replace objAPI-generated Pack func with method

See discussion at https://github.com/google/flatbuffers/issues/5668

* go: replace generated union type UnPack func with method

Similar to discussion https://github.com/google/flatbuffers/issues/5668

But signature:
```
func AnyUnPack(t Any, table flatbuffers.Table) *AnyT
```

Becomes,
```
func (rcv Any) UnPack(table flatbuffers.Table) *AnyT
```
This commit is contained in:
Somo
2020-01-16 19:19:00 -05:00
committed by Wouter van Oortmerssen
parent 01189d7edd
commit bee1df96dc
20 changed files with 79 additions and 88 deletions

View File

@@ -463,7 +463,7 @@ func CheckObjectAPI(buf []byte, offset flatbuffers.UOffsetT, fail func(string, .
}
builder := flatbuffers.NewBuilder(0)
builder.Finish(example.MonsterPack(builder, monster))
builder.Finish(monster.Pack(builder))
monster2 := example.GetRootAsMonster(builder.FinishedBytes(), 0).UnPack()
if !reflect.DeepEqual(monster, monster2) {
fail(FailString("Pack/Unpack()", monster, monster2))