[
https://issues.apache.org/jira/browse/THRIFT-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16650202#comment-16650202
]
ASF GitHub Bot commented on THRIFT-4650:
----------------------------------------
dcelasun edited a comment on issue #1610: THRIFT-4650: fixes incorrectly
marking required fields as being set
URL: https://github.com/apache/thrift/pull/1610#issuecomment-429850776
This is mostly from memory so apologies if there are any errors.
You need to compile Thrift itself and run `make -k check` in `lib/go/test`.
To compile Thrift with only Go support, run the following at the root of the
repository:
```sh
$ sh bootstrap.sh
$ ./configure --prefix=/usr \
--without-cpp \
--without-c_glib \
--without-qt4 \
--without-qt5 \
--without-libevent \
--without-csharp \
--without-haskell \
--without-php \
--without-ruby \
--without-python \
--without-erlang \
--without-perl \
--without-java \
--without-c_sharp \
--without-d \
--without-php \
--with-go \
--without-lua \
--without-nodejs \
--without-rs
$ make
```
This will create a `thrift` binary in `compiler/cpp/thrift`. Make sure
that's in your `$PATH` and run `make -k check` in `lib/go/test`.
The other option is to just update your PR and let Travis run them.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Required field incorrectly marked as set when fieldType does not match
> ----------------------------------------------------------------------
>
> Key: THRIFT-4650
> URL: https://issues.apache.org/jira/browse/THRIFT-4650
> Project: Thrift
> Issue Type: Bug
> Components: Go - Compiler
> Affects Versions: 0.11.0
> Reporter: Craig W
> Priority: Major
>
> The "Read" function that gets generated incorrectly marks required fields as
> being set when the type of the field does not match what's expected.
> {{For example, the following IDL:}}
> {{struct Foo {}}
> {{ 1: required string id}}
> {{}}}
> {{The generated Read function has the following:}}
> {{switch fieldId {}}
> {{ case 1:}}
> {{ if fieldTypeId == thrift.STRING {}}
> {{ if err := p.ReadField1(iprot); err != nil {}}
> {{ return err}}
> }
> {{ } else {}}
> {{ if err := iprot.Skip(fieldTypeId); err != nil {}}
> {{ return err}}
> }
> }
> {{ issetID = true}}
> {{}}}
> {{I ran into a case where I attempted to deserialize another message type
> into type Foo, and I expected it to return an error, but it did not.}}
> f : = Foo{}
> err := thrift.NewTDeserializer().Read(&f, bytes)
> {{I think [this
> code|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_go_generator.cc#L1600]
> in the generator needs to be moved inside the first "if" block, so that its
> only set to true if it actually reads the data of the correct type.}}
> {{ }}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)