THRIFT-5358: Add go.mod file to root directory
Client: go
This unblocks the development under go 1.16+, which starts to complain
when there's no go.mod file in any of the directories.
The current approach is certainly not the best solution ever, for
example it does not run the tests under lib/go/test/tests but copy them
into lib/go/test/gopath/src/sometest and run them there instead, but
those improvements can be done in the future in follow up PRs and this
should be a good enough first step to unblock developments.
diff --git a/test/go/src/bin/stress/main.go b/test/go/src/bin/stress/main.go
index f2e0f20..3ff0a39 100644
--- a/test/go/src/bin/stress/main.go
+++ b/test/go/src/bin/stress/main.go
@@ -23,7 +23,6 @@
"context"
"flag"
"fmt"
- "gen/stress"
"log"
_ "net/http/pprof"
"os"
@@ -31,8 +30,10 @@
"runtime/pprof"
"sync"
"sync/atomic"
- "thrift"
"time"
+
+ "github.com/apache/thrift/lib/go/thrift"
+ "github.com/apache/thrift/test/go/src/gen/stress"
)
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to this file")
diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go
index 4357ee8..39ee95b 100644
--- a/test/go/src/bin/testclient/main.go
+++ b/test/go/src/bin/testclient/main.go
@@ -20,13 +20,14 @@
package main
import (
- "common"
"context"
"flag"
- "gen/thrifttest"
t "log"
"reflect"
- "thrift"
+
+ "github.com/apache/thrift/lib/go/thrift"
+ "github.com/apache/thrift/test/go/src/common"
+ "github.com/apache/thrift/test/go/src/gen/thrifttest"
)
var host = flag.String("host", "localhost", "Host to connect")
@@ -50,8 +51,8 @@
}
var rmapmap = map[int32]map[int32]int32{
- -4: map[int32]int32{-4: -4, -3: -3, -2: -2, -1: -1},
- 4: map[int32]int32{4: 4, 3: 3, 2: 2, 1: 1},
+ -4: {-4: -4, -3: -3, -2: -2, -1: -1},
+ 4: {4: 4, 3: 3, 2: 2, 1: 1},
}
var xxs = &thrifttest.Xtruct{
diff --git a/test/go/src/bin/testserver/main.go b/test/go/src/bin/testserver/main.go
index 6fc1185..d4bd8b4 100644
--- a/test/go/src/bin/testserver/main.go
+++ b/test/go/src/bin/testserver/main.go
@@ -20,12 +20,13 @@
package main
import (
- "common"
"flag"
"fmt"
"log"
"net/http"
- "thrift"
+
+ "github.com/apache/thrift/lib/go/thrift"
+ "github.com/apache/thrift/test/go/src/common"
)
var host = flag.String("host", "localhost", "Host to connect")
diff --git a/test/go/src/common/client.go b/test/go/src/common/client.go
index ed820ae..15973d8 100644
--- a/test/go/src/common/client.go
+++ b/test/go/src/common/client.go
@@ -24,9 +24,10 @@
"crypto/tls"
"flag"
"fmt"
- "gen/thrifttest"
"net/http"
- "thrift"
+
+ "github.com/apache/thrift/lib/go/thrift"
+ "github.com/apache/thrift/test/go/src/gen/thrifttest"
)
var debugClientProtocol bool
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index 9f93c4c..d5e3c43 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -22,13 +22,14 @@
import (
"context"
"errors"
- "gen/thrifttest"
"reflect"
"sync"
"testing"
- "thrift"
"github.com/golang/mock/gomock"
+
+ "github.com/apache/thrift/lib/go/thrift"
+ "github.com/apache/thrift/test/go/src/gen/thrifttest"
)
type test_unit struct {
@@ -84,8 +85,8 @@
}
var rmapmap = map[int32]map[int32]int32{
- -4: map[int32]int32{-4: -4, -3: -3, -2: -2, -1: -1},
- 4: map[int32]int32{4: 4, 3: 3, 2: 2, 1: 1},
+ -4: {-4: -4, -3: -3, -2: -2, -1: -1},
+ 4: {4: 4, 3: 3, 2: 2, 1: 1},
}
var xxs = &thrifttest.Xtruct{
diff --git a/test/go/src/common/context_test.go b/test/go/src/common/context_test.go
index e64dbb9..3e21a54 100644
--- a/test/go/src/common/context_test.go
+++ b/test/go/src/common/context_test.go
@@ -28,8 +28,9 @@
"os"
"syscall"
"testing"
- "thrift"
"time"
+
+ "github.com/apache/thrift/lib/go/thrift"
)
type slowHttpHandler struct{}
diff --git a/test/go/src/common/printing_handler.go b/test/go/src/common/printing_handler.go
index 2b22d0c..d91dde4 100644
--- a/test/go/src/common/printing_handler.go
+++ b/test/go/src/common/printing_handler.go
@@ -24,8 +24,9 @@
"encoding/hex"
"errors"
"fmt"
- . "gen/thrifttest"
"time"
+
+ . "github.com/apache/thrift/test/go/src/gen/thrifttest"
)
var PrintingHandler = &printingHandler{}
@@ -192,7 +193,7 @@
func (p *printingHandler) TestSet(ctx context.Context, thing []int32) (r []int32, err error) {
fmt.Printf("testSet({")
first := true
- for k, _ := range thing {
+ for k := range thing {
if first {
first = false
} else {
@@ -256,8 +257,8 @@
fmt.Printf("testMapMap(%d)\n", hello)
r = map[int32]map[int32]int32{
- -4: map[int32]int32{-4: -4, -3: -3, -2: -2, -1: -1},
- 4: map[int32]int32{4: 4, 3: 3, 2: 2, 1: 1},
+ -4: {-4: -4, -3: -3, -2: -2, -1: -1},
+ 4: {4: 4, 3: 3, 2: 2, 1: 1},
}
return
}
diff --git a/test/go/src/common/server.go b/test/go/src/common/server.go
index c6674ae..6e3a5d3 100644
--- a/test/go/src/common/server.go
+++ b/test/go/src/common/server.go
@@ -24,8 +24,9 @@
"crypto/tls"
"flag"
"fmt"
- "gen/thrifttest"
- "thrift"
+
+ "github.com/apache/thrift/lib/go/thrift"
+ "github.com/apache/thrift/test/go/src/gen/thrifttest"
)
var (
diff --git a/test/go/src/common/simple_handler.go b/test/go/src/common/simple_handler.go
index 0c9463d..971f17e 100644
--- a/test/go/src/common/simple_handler.go
+++ b/test/go/src/common/simple_handler.go
@@ -21,8 +21,9 @@
import (
"errors"
- . "gen/thrifttest"
"time"
+
+ . "github.com/apache/thrift/test/go/src/gen/thrifttest"
)
var SimpleHandler = &simpleHandler{}
@@ -96,8 +97,8 @@
func (p *simpleHandler) TestMapMap(hello int32) (r map[int32]map[int32]int32, err error) {
r = map[int32]map[int32]int32{
- -4: map[int32]int32{-4: -4, -3: -3, -2: -2, -1: -1},
- 4: map[int32]int32{4: 4, 3: 3, 2: 2, 1: 1},
+ -4: {-4: -4, -3: -3, -2: -2, -1: -1},
+ 4: {4: 4, 3: 3, 2: 2, 1: 1},
}
return
}