THRIFT-3302 Go JSON protocol should encode Thrift byte type as signed integer string
Client: Go
Patch: Nobuaki Sukegawa <nsukeg@gmail.com>
This closes #591
diff --git a/lib/go/thrift/json_protocol.go b/lib/go/thrift/json_protocol.go
index 41cd218..669a7bd 100644
--- a/lib/go/thrift/json_protocol.go
+++ b/lib/go/thrift/json_protocol.go
@@ -69,7 +69,7 @@
if e := p.WriteString(name); e != nil {
return e
}
- if e := p.WriteByte(byte(typeId)); e != nil {
+ if e := p.WriteByte(int8(typeId)); e != nil {
return e
}
if e := p.WriteI32(seqId); e != nil {
@@ -170,7 +170,7 @@
return p.WriteI32(0)
}
-func (p *TJSONProtocol) WriteByte(b byte) error {
+func (p *TJSONProtocol) WriteByte(b int8) error {
return p.WriteI32(int32(b))
}
@@ -349,9 +349,9 @@
return (value != 0), err
}
-func (p *TJSONProtocol) ReadByte() (byte, error) {
+func (p *TJSONProtocol) ReadByte() (int8, error) {
v, err := p.ReadI64()
- return byte(v), err
+ return int8(v), err
}
func (p *TJSONProtocol) ReadI16() (int16, error) {