[
https://issues.apache.org/jira/browse/THRIFT-5807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112677#comment-18112677
]
Sylwester Lachiewicz commented on THRIFT-5807:
----------------------------------------------
A fix has been submitted in PR #3823: https://github.com/apache/thrift/pull/3823
Changes:
1. Updated Enum.String() in t_go_generator.cc to return fmt.Sprintf("%s(%d)",
tenum_name, p) for out-of-range values, matching idiomatic Go stringer
conventions.
2. Generated (p Enum) IsDefined() bool method on all enums.
3. Updated go_validator_generator.cc to check !tgt.IsDefined() instead of
checking for "<UNSET>".
4. Added unit tests in enum_values_test.go.
> Generated Go enums' always appear to be <UNSET> for out of ranges values in
> enum
> --------------------------------------------------------------------------------
>
> Key: THRIFT-5807
> URL: https://issues.apache.org/jira/browse/THRIFT-5807
> Project: Thrift
> Issue Type: Bug
> Components: Go - Library
> Affects Versions: 0.19.0, 0.20.0
> Reporter: Team_RPCtester
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Hi,
> We discover an inconsistent behavior illustrated by the following example.
>
> {code:java}
> namespace go commonResource
> enum Enum_0 {
> e_0 = 0,
> e_1 = 1,
> }
> struct StructClass_0 {
> 1: required Enum_0 f_1,
> }
> service DataService {
> StructClass_0 Method_3(1: StructClass_0 agr_method_3)
> }
> {code}
>
> When the value of f_1 is set to 10(which is out of 0 and 1), the Go client
> side displays UNSET, while other languages correctly transmit the value 10.
> Thank you.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)