Fix field stop read in duplicate_protocol.go (#3125)

When generated code reads a struct, it runs a `for` loop calling
`ReadFieldBegin` at the top, but breaks if the field type ID is
`thrift.STOP`.

With TDuplicateToProtocol naively writing everything read, this results
in extra writes, which breaks just about any protocol in the
`DuplicateTo` struct field.

The proposed fix is to simply add special handling for `thrift.STOP` to
`ReadFieldBegin`.

I'm no thrift expert, so I have no idea how other libraries handle this
concern.  Ideally, it seems like each protocol should understand and
enforce the invariant that an attempt to call `WriteFieldBegin` with
type ID 0 either isn't valid or is a misguided attempt to call
`WriteFieldStop`.

Co-authored-by: Yuxuan 'fishy' Wang <fishywang@gmail.com>
2 files changed