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/tutorial/go/src/client.go b/tutorial/go/src/client.go
index 319ca3e..8776f9c 100644
--- a/tutorial/go/src/client.go
+++ b/tutorial/go/src/client.go
@@ -23,9 +23,9 @@
"context"
"crypto/tls"
"fmt"
- "tutorial"
"github.com/apache/thrift/lib/go/thrift"
+ "github.com/apache/thrift/tutorial/go/gen-go/tutorial"
)
var defaultCtx = context.Background()
diff --git a/tutorial/go/src/handler.go b/tutorial/go/src/handler.go
index 5c0eed0..7645fc2 100644
--- a/tutorial/go/src/handler.go
+++ b/tutorial/go/src/handler.go
@@ -22,9 +22,10 @@
import (
"context"
"fmt"
- "shared"
"strconv"
- "tutorial"
+
+ "github.com/apache/thrift/tutorial/go/gen-go/shared"
+ "github.com/apache/thrift/tutorial/go/gen-go/tutorial"
)
type CalculatorHandler struct {
diff --git a/tutorial/go/src/main.go b/tutorial/go/src/main.go
index 7730d7b..afac6bb 100644
--- a/tutorial/go/src/main.go
+++ b/tutorial/go/src/main.go
@@ -22,8 +22,9 @@
import (
"flag"
"fmt"
- "github.com/apache/thrift/lib/go/thrift"
"os"
+
+ "github.com/apache/thrift/lib/go/thrift"
)
func Usage() {
diff --git a/tutorial/go/src/server.go b/tutorial/go/src/server.go
index 95708eb..1171ca6 100644
--- a/tutorial/go/src/server.go
+++ b/tutorial/go/src/server.go
@@ -22,8 +22,9 @@
import (
"crypto/tls"
"fmt"
+
"github.com/apache/thrift/lib/go/thrift"
- "tutorial"
+ "github.com/apache/thrift/tutorial/go/gen-go/tutorial"
)
func runServer(transportFactory thrift.TTransportFactory, protocolFactory thrift.TProtocolFactory, addr string, secure bool) error {
@@ -40,7 +41,7 @@
} else {
transport, err = thrift.NewTServerSocket(addr)
}
-
+
if err != nil {
return err
}