THRIFT-4448: Golang: do something with context.Context. Remove Go1.6 compatibility.
Client: go
This closes #1459
diff --git a/test/go/src/bin/stress/go17.go b/test/go/src/bin/stress/go17.go
deleted file mode 100644
index 81f1ad8..0000000
--- a/test/go/src/bin/stress/go17.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// +build go1.7
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package main
-
-import (
- "context"
- "sync/atomic"
-)
-
-type handler struct{}
-
-func (h *handler) EchoVoid(ctx context.Context) (err error) {
- atomic.AddInt64(&counter, 1)
- return nil
-}
-func (h *handler) EchoByte(ctx context.Context, arg int8) (r int8, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoI32(ctx context.Context, arg int32) (r int32, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoI64(ctx context.Context, arg int64) (r int64, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoString(ctx context.Context, arg string) (r string, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoList(ctx context.Context, arg []int8) (r []int8, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoSet(ctx context.Context, arg map[int8]struct{}) (r map[int8]struct{}, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoMap(ctx context.Context, arg map[int8]int8) (r map[int8]int8, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
diff --git a/test/go/src/bin/stress/main.go b/test/go/src/bin/stress/main.go
index e8e6b2a..f2e0f20 100644
--- a/test/go/src/bin/stress/main.go
+++ b/test/go/src/bin/stress/main.go
@@ -20,6 +20,7 @@
package main
import (
+ "context"
"flag"
"fmt"
"gen/stress"
@@ -216,3 +217,38 @@
done.Done()
}
+
+type handler struct{}
+
+func (h *handler) EchoVoid(ctx context.Context) (err error) {
+ atomic.AddInt64(&counter, 1)
+ return nil
+}
+func (h *handler) EchoByte(ctx context.Context, arg int8) (r int8, err error) {
+ atomic.AddInt64(&counter, 1)
+ return arg, nil
+}
+func (h *handler) EchoI32(ctx context.Context, arg int32) (r int32, err error) {
+ atomic.AddInt64(&counter, 1)
+ return arg, nil
+}
+func (h *handler) EchoI64(ctx context.Context, arg int64) (r int64, err error) {
+ atomic.AddInt64(&counter, 1)
+ return arg, nil
+}
+func (h *handler) EchoString(ctx context.Context, arg string) (r string, err error) {
+ atomic.AddInt64(&counter, 1)
+ return arg, nil
+}
+func (h *handler) EchoList(ctx context.Context, arg []int8) (r []int8, err error) {
+ atomic.AddInt64(&counter, 1)
+ return arg, nil
+}
+func (h *handler) EchoSet(ctx context.Context, arg map[int8]struct{}) (r map[int8]struct{}, err error) {
+ atomic.AddInt64(&counter, 1)
+ return arg, nil
+}
+func (h *handler) EchoMap(ctx context.Context, arg map[int8]int8) (r map[int8]int8, err error) {
+ atomic.AddInt64(&counter, 1)
+ return arg, nil
+}
diff --git a/test/go/src/bin/stress/pre_go17.go b/test/go/src/bin/stress/pre_go17.go
deleted file mode 100644
index 07ae5c6..0000000
--- a/test/go/src/bin/stress/pre_go17.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// +build !go1.7
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package main
-
-import (
- "sync/atomic"
-
- "golang.org/x/net/context"
-)
-
-type handler struct{}
-
-func (h *handler) EchoVoid(ctx context.Context) (err error) {
- atomic.AddInt64(&counter, 1)
- return nil
-}
-func (h *handler) EchoByte(ctx context.Context, arg int8) (r int8, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoI32(ctx context.Context, arg int32) (r int32, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoI64(ctx context.Context, arg int64) (r int64, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoString(ctx context.Context, arg string) (r string, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoList(ctx context.Context, arg []int8) (r []int8, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoSet(ctx context.Context, arg map[int8]struct{}) (r map[int8]struct{}, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
-func (h *handler) EchoMap(ctx context.Context, arg map[int8]int8) (r map[int8]int8, err error) {
- atomic.AddInt64(&counter, 1)
- return arg, nil
-}
diff --git a/test/go/src/bin/testclient/go17.go b/test/go/src/bin/testclient/go17.go
deleted file mode 100644
index a6003a9..0000000
--- a/test/go/src/bin/testclient/go17.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build go1.7
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package main
-
-import "context"
-
-var defaultCtx = context.Background()
diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go
index ab24cbf..20104f9 100644
--- a/test/go/src/bin/testclient/main.go
+++ b/test/go/src/bin/testclient/main.go
@@ -21,6 +21,7 @@
import (
"common"
+ "context"
"flag"
"gen/thrifttest"
t "log"
@@ -60,6 +61,7 @@
}
var xcept = &thrifttest.Xception{ErrorCode: 1001, Message: "Xception"}
+var defaultCtx = context.Background()
func callEverything(client *thrifttest.ThriftTestClient) {
var err error
diff --git a/test/go/src/bin/testclient/pre_go17.go b/test/go/src/bin/testclient/pre_go17.go
deleted file mode 100644
index 10a6fb8..0000000
--- a/test/go/src/bin/testclient/pre_go17.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build !go1.7
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package main
-
-import "golang.org/x/net/context"
-
-var defaultCtx = context.Background()