THRIFT-3149 go: make generated readFieldN methods private
Client: Go
Patch: Konstantin Shaposhnikov <k.shaposhnikov@gmail.com>
This closes #496
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index 567cb3d..82340fd 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -1408,7 +1408,7 @@
field_id = (*f_iter)->get_key();
// if negative id, ensure we generate a valid method name
- string field_method_prefix("ReadField");
+ string field_method_prefix("readField");
if (field_id < 0) {
field_method_prefix += "_";
@@ -1485,7 +1485,7 @@
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
string field_type_name(publicize((*f_iter)->get_type()->get_name()));
string field_name(publicize((*f_iter)->get_name()));
- string field_method_prefix("ReadField");
+ string field_method_prefix("readField");
int32_t field_id = (*f_iter)->get_key();
if (field_id < 0) {
diff --git a/lib/go/thrift/serializer_types.go b/lib/go/thrift/serializer_types.go
index 5969b21..52098a0 100644
--- a/lib/go/thrift/serializer_types.go
+++ b/lib/go/thrift/serializer_types.go
@@ -176,51 +176,51 @@
}
switch fieldId {
case 1:
- if err := p.ReadField1(iprot); err != nil {
+ if err := p.readField1(iprot); err != nil {
return err
}
case 2:
- if err := p.ReadField2(iprot); err != nil {
+ if err := p.readField2(iprot); err != nil {
return err
}
case 3:
- if err := p.ReadField3(iprot); err != nil {
+ if err := p.readField3(iprot); err != nil {
return err
}
case 4:
- if err := p.ReadField4(iprot); err != nil {
+ if err := p.readField4(iprot); err != nil {
return err
}
case 5:
- if err := p.ReadField5(iprot); err != nil {
+ if err := p.readField5(iprot); err != nil {
return err
}
case 6:
- if err := p.ReadField6(iprot); err != nil {
+ if err := p.readField6(iprot); err != nil {
return err
}
case 7:
- if err := p.ReadField7(iprot); err != nil {
+ if err := p.readField7(iprot); err != nil {
return err
}
case 8:
- if err := p.ReadField8(iprot); err != nil {
+ if err := p.readField8(iprot); err != nil {
return err
}
case 9:
- if err := p.ReadField9(iprot); err != nil {
+ if err := p.readField9(iprot); err != nil {
return err
}
case 10:
- if err := p.ReadField10(iprot); err != nil {
+ if err := p.readField10(iprot); err != nil {
return err
}
case 11:
- if err := p.ReadField11(iprot); err != nil {
+ if err := p.readField11(iprot); err != nil {
return err
}
case 12:
- if err := p.ReadField12(iprot); err != nil {
+ if err := p.readField12(iprot); err != nil {
return err
}
default:
@@ -238,7 +238,7 @@
return nil
}
-func (p *TestStruct) ReadField1(iprot TProtocol) error {
+func (p *TestStruct) readField1(iprot TProtocol) error {
if v, err := iprot.ReadBool(); err != nil {
return PrependError("error reading field 1: ", err)
} else {
@@ -247,7 +247,7 @@
return nil
}
-func (p *TestStruct) ReadField2(iprot TProtocol) error {
+func (p *TestStruct) readField2(iprot TProtocol) error {
if v, err := iprot.ReadByte(); err != nil {
return PrependError("error reading field 2: ", err)
} else {
@@ -257,7 +257,7 @@
return nil
}
-func (p *TestStruct) ReadField3(iprot TProtocol) error {
+func (p *TestStruct) readField3(iprot TProtocol) error {
if v, err := iprot.ReadI16(); err != nil {
return PrependError("error reading field 3: ", err)
} else {
@@ -266,7 +266,7 @@
return nil
}
-func (p *TestStruct) ReadField4(iprot TProtocol) error {
+func (p *TestStruct) readField4(iprot TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return PrependError("error reading field 4: ", err)
} else {
@@ -275,7 +275,7 @@
return nil
}
-func (p *TestStruct) ReadField5(iprot TProtocol) error {
+func (p *TestStruct) readField5(iprot TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return PrependError("error reading field 5: ", err)
} else {
@@ -284,7 +284,7 @@
return nil
}
-func (p *TestStruct) ReadField6(iprot TProtocol) error {
+func (p *TestStruct) readField6(iprot TProtocol) error {
if v, err := iprot.ReadDouble(); err != nil {
return PrependError("error reading field 6: ", err)
} else {
@@ -293,7 +293,7 @@
return nil
}
-func (p *TestStruct) ReadField7(iprot TProtocol) error {
+func (p *TestStruct) readField7(iprot TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return PrependError("error reading field 7: ", err)
} else {
@@ -302,7 +302,7 @@
return nil
}
-func (p *TestStruct) ReadField8(iprot TProtocol) error {
+func (p *TestStruct) readField8(iprot TProtocol) error {
if v, err := iprot.ReadBinary(); err != nil {
return PrependError("error reading field 8: ", err)
} else {
@@ -311,7 +311,7 @@
return nil
}
-func (p *TestStruct) ReadField9(iprot TProtocol) error {
+func (p *TestStruct) readField9(iprot TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return PrependError("error reading map begin: ", err)
@@ -339,7 +339,7 @@
return nil
}
-func (p *TestStruct) ReadField10(iprot TProtocol) error {
+func (p *TestStruct) readField10(iprot TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return PrependError("error reading list begin: ", err)
@@ -361,7 +361,7 @@
return nil
}
-func (p *TestStruct) ReadField11(iprot TProtocol) error {
+func (p *TestStruct) readField11(iprot TProtocol) error {
_, size, err := iprot.ReadSetBegin()
if err != nil {
return PrependError("error reading set begin: ", err)
@@ -383,7 +383,7 @@
return nil
}
-func (p *TestStruct) ReadField12(iprot TProtocol) error {
+func (p *TestStruct) readField12(iprot TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return PrependError("error reading field 12: ", err)
} else {