pomack/thrift4go — pull request #19 by matttproud (2012-07-10 00:09:15+00:00)
Title: Fix generated enum field code without defaults.

The original generated Go code for Thrift enum fields possessed an
anomaly whereby structs that have enum fields without default values
assumed such a field is unset if its value is zero. Now, according to
http://wiki.apache.org/thrift/Tutorial, an enum with unvalued elements
starts its first element at zero, so the original means of field
comprehension has problems, specifically because Go default
initialization value for numbers is zero.

To remedy this, the code generator now assumes internally that enums
are int64 instead of the original int (i.e., int32); however, all
consumers of the enum still see the enum as int. With that, structs
with enum fields that lack assigned value now default to
math.MinInt32 - 1 and use this to validate whether the field was
explicitly set.