From: Jens Geyer Date: Sat, 7 Sep 2013 22:31:20 +0000 (+0200) Subject: THRIFT-2170 Generated Go code should populate all ReadErrors completely X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=c949514e41f9e2b31b061f1d81fd5305d0861a46;p=common%2Fthrift.git THRIFT-2170 Generated Go code should populate all ReadErrors completely Patch: Jens Geyer --- diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc index eecc8362..24af687e 100644 --- a/compiler/cpp/src/generate/t_go_generator.cc +++ b/compiler/cpp/src/generate/t_go_generator.cc @@ -1129,7 +1129,7 @@ void t_go_generator::generate_go_struct_reader(ofstream& out, indent_up(); out << indent() << "if _, err := iprot.ReadStructBegin(); err != nil {" << endl << - indent() << " return fmt.Errorf(\"%T read error\", p)" << endl << + indent() << " return fmt.Errorf(\"%T read error: %s\", p, err)" << endl << indent() << "}" << endl; // Loop over reading in fields indent(out) << "for {" << endl; diff --git a/tutorial/go/src/main.go b/tutorial/go/src/main.go index 96e5ec91..63154e3b 100644 --- a/tutorial/go/src/main.go +++ b/tutorial/go/src/main.go @@ -35,7 +35,7 @@ func Usage() { func main() { flag.Usage = Usage server := flag.Bool("server", false, "Run server") - protocol := flag.String("P", "binary", "Specify the protocol (binary, compact, simplejson)") + protocol := flag.String("P", "binary", "Specify the protocol (binary, compact, json, simplejson)") framed := flag.Bool("framed", false, "Use framed transport") buffered := flag.Bool("buffered", false, "Use buffered transport") addr := flag.String("addr", "localhost:9090", "Address to listen to")