THRIFT-1350: Go library code does not build against latest release
Client: go
Patch: Kyle Consalus
Go has moved it's URL-handling code into a "url" package, patch updates for these new changes.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1172901 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/go/thrift/thttp_client.go b/lib/go/thrift/thttp_client.go
index 08dd9ce..2ec4b28 100644
--- a/lib/go/thrift/thttp_client.go
+++ b/lib/go/thrift/thttp_client.go
@@ -24,12 +24,13 @@
"http"
"os"
"strconv"
+ "url"
)
type THttpClient struct {
response *http.Response
- url *http.URL
+ url *url.URL
requestBuffer *bytes.Buffer
nsecConnectTimeout int64
nsecReadTimeout int64
@@ -69,20 +70,20 @@
}
-func NewTHttpClient(url string) (TTransport, os.Error) {
- parsedURL, err := http.ParseURL(url)
+func NewTHttpClient(urlstr string) (TTransport, os.Error) {
+ parsedURL, err := url.Parse(urlstr)
if err != nil {
return nil, err
}
- response, err := http.Get(url)
+ response, err := http.Get(urlstr)
if err != nil {
return nil, err
}
return &THttpClient{response: response, url: parsedURL}, nil
}
-func NewTHttpPostClient(url string) (TTransport, os.Error) {
- parsedURL, err := http.ParseURL(url)
+func NewTHttpPostClient(urlstr string) (TTransport, os.Error) {
+ parsedURL, err := url.Parse(urlstr)
if err != nil {
return nil, err
}
diff --git a/lib/go/thrift/tsimple_json_protocol_test.go b/lib/go/thrift/tsimple_json_protocol_test.go
index e57d55b..f6f5f48 100644
--- a/lib/go/thrift/tsimple_json_protocol_test.go
+++ b/lib/go/thrift/tsimple_json_protocol_test.go
@@ -578,7 +578,7 @@
if str[0] != '[' || str[len(str)-1] != ']' {
t.Fatalf("Bad value for %s, wrote: %q, in go: %q", thetype, str, DOUBLE_VALUES)
}
- l := strings.Split(str[1:len(str)-1], ",", -1)
+ l := strings.Split(str[1:len(str)-1], ",")
if len(l) < 3 {
t.Fatal("Expected list of at least length 3 for map for metadata, but was of length ", len(l))
}