THRIFT-4612: THeader support in go library

Client: go

Implement THeaderTransport and THeaderProtocol, with support of:

* clients:
  - headers
  - framedBinary
  - unframedBinary
  - framedCompact
  - unframedCompact
* transforms:
  - none
  - zlib
* info types:
  - key_value
* wrapped protocols:
  - TBinary
  - TCompact

The support list is in general on par of the THeader implementation in
the python library.

The cross-test passes, except ones related to cpp/nodejs http transport,
which were also failing for non-theader protocols.

This change also fixes two bugs:

1. A small issue in test/go/src/bin/testserver/main.go
2. A bug in TFrameTransport go implementation
diff --git a/test/go/src/bin/testserver/main.go b/test/go/src/bin/testserver/main.go
index ca2d967..6fc1185 100644
--- a/test/go/src/bin/testserver/main.go
+++ b/test/go/src/bin/testserver/main.go
@@ -32,7 +32,7 @@
 var port = flag.Int64("port", 9090, "Port number to connect")
 var domain_socket = flag.String("domain-socket", "", "Domain Socket (e.g. /tmp/ThriftTest.thrift), instead of host and port")
 var transport = flag.String("transport", "buffered", "Transport: buffered, framed, http, zlib")
-var protocol = flag.String("protocol", "binary", "Protocol: binary, compact, json")
+var protocol = flag.String("protocol", "binary", "Protocol: binary, compact, json, header")
 var ssl = flag.Bool("ssl", false, "Encrypted Transport using SSL")
 var zlib = flag.Bool("zlib", false, "Wrapped Transport using Zlib")
 var certPath = flag.String("certPath", "keys", "Directory that contains SSL certificates")
@@ -43,7 +43,7 @@
 	processor, serverTransport, transportFactory, protocolFactory, err := common.GetServerParams(*host, *port, *domain_socket, *transport, *protocol, *ssl, *certPath, common.PrintingHandler)
 
 	if err != nil {
-		log.Fatalf("Unable to process server params: ", err)
+		log.Fatalf("Unable to process server params: %v", err)
 	}
 
 	if *transport == "http" {
diff --git a/test/go/src/common/client.go b/test/go/src/common/client.go
index 236ce43..ed820ae 100644
--- a/test/go/src/common/client.go
+++ b/test/go/src/common/client.go
@@ -55,6 +55,8 @@
 		protocolFactory = thrift.NewTJSONProtocolFactory()
 	case "binary":
 		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
+	case "header":
+		protocolFactory = thrift.NewTHeaderProtocolFactory()
 	default:
 		return nil, nil, fmt.Errorf("Invalid protocol specified %s", protocol)
 	}
diff --git a/test/go/src/common/server.go b/test/go/src/common/server.go
index 5ac4400..c6674ae 100644
--- a/test/go/src/common/server.go
+++ b/test/go/src/common/server.go
@@ -60,6 +60,8 @@
 		protocolFactory = thrift.NewTJSONProtocolFactory()
 	case "binary":
 		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
+	case "header":
+		protocolFactory = thrift.NewTHeaderProtocolFactory()
 	default:
 		return nil, nil, nil, nil, fmt.Errorf("Invalid protocol specified %s", protocol)
 	}
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index 6c61d5a..9f97754 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -31,12 +31,16 @@
   "cpp-go_binary_http-ip-ssl",
   "cpp-go_compact_http-ip",
   "cpp-go_compact_http-ip-ssl",
+  "cpp-go_header_http-ip",
+  "cpp-go_header_http-ip-ssl",
   "cpp-go_json_http-ip",
   "cpp-go_json_http-ip-ssl",
   "cpp-go_multi-binary_http-ip",
   "cpp-go_multi-binary_http-ip-ssl",
   "cpp-go_multic-compact_http-ip",
   "cpp-go_multic-compact_http-ip-ssl",
+  "cpp-go_multih-header_http-ip",
+  "cpp-go_multih-header_http-ip-ssl",
   "cpp-go_multij-json_http-ip",
   "cpp-go_multij-json_http-ip-ssl",
   "cpp-java_binary_http-ip",
@@ -304,6 +308,8 @@
   "go-cpp_binary_http-ip-ssl",
   "go-cpp_compact_http-ip",
   "go-cpp_compact_http-ip-ssl",
+  "go-cpp_header_http-ip",
+  "go-cpp_header_http-ip-ssl",
   "go-cpp_json_http-ip",
   "go-cpp_json_http-ip-ssl",
   "go-d_binary_http-ip",
@@ -357,6 +363,8 @@
   "nodejs-go_binary_http-ip-ssl",
   "nodejs-go_compact_http-ip",
   "nodejs-go_compact_http-ip-ssl",
+  "nodejs-go_header_http-ip",
+  "nodejs-go_header_http-ip-ssl",
   "nodejs-go_json_http-ip",
   "nodejs-go_json_http-ip-ssl",
   "nodejs-hs_binary_http-ip",
diff --git a/test/tests.json b/test/tests.json
index a4680d1..851244e 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -115,7 +115,8 @@
     "protocols": [
       "binary",
       "compact",
-      "json"
+      "json",
+      "header"
     ],
     "workdir": "go/bin"
   },