THRIFT-2170 Generated Go code should populate all ReadErrors completely
authorJens Geyer <jensg@apache.org>
Sat, 7 Sep 2013 22:31:20 +0000 (00:31 +0200)
committerJens Geyer <jensg@apache.org>
Sat, 7 Sep 2013 22:31:59 +0000 (00:31 +0200)
Patch: Jens Geyer

compiler/cpp/src/generate/t_go_generator.cc
tutorial/go/src/main.go

index eecc836..24af687 100644 (file)
@@ -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;
index 96e5ec9..63154e3 100644 (file)
@@ -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")