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/Makefile.am b/test/go/Makefile.am
index eae153c..d7db957 100644
--- a/test/go/Makefile.am
+++ b/test/go/Makefile.am
@@ -19,7 +19,7 @@
 
 BUILT_SOURCES = gopath
 
-THRIFTCMD = $(THRIFT) -out src/gen --gen go:thrift_import=thrift$(COMPILER_EXTRAFLAG)
+THRIFTCMD = $(THRIFT) -out src/gen --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift,package_prefix=github.com/apache/thrift/test/go/src/gen/$(COMPILER_EXTRAFLAG)
 THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
 
 precross: bin/testclient bin/testserver
@@ -34,20 +34,16 @@
 	mkdir -p src/gen
 	$(THRIFTCMD) ThriftTest.thrift
 	$(THRIFTCMD) ../StressTest.thrift
-	GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock || true
-	sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' src/github.com/golang/mock/gomock/controller.go || true
-	GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock
-	ln -nfs ../../../lib/go/thrift src/thrift
 	touch gopath
 
 bin/testclient: gopath
-	GOPATH=`pwd` $(GO) install bin/testclient
+	GOPATH=`pwd` $(GO) install -mod=mod ./src/bin/testclient
 
 bin/testserver: gopath
-	GOPATH=`pwd` $(GO) install bin/testserver
+	GOPATH=`pwd` $(GO) install -mod=mod ./src/bin/testserver
 
 bin/stress: gopath
-	GOPATH=`pwd` $(GO) install bin/stress
+	GOPATH=`pwd` $(GO) install -mod=mod ./src/bin/stress
 
 clean-local:
 	$(RM) -r src/gen src/github.com/golang src/thrift bin pkg gopath ThriftTest.thrift
@@ -55,7 +51,7 @@
 check_PROGRAMS: bin/testclient bin/testserver bin/stress
 
 check: gopath genmock
-	GOPATH=`pwd` $(GO) test -v common/...
+	$(GO) test -mod=mod -v ./src/common/...
 
 genmock: gopath
 	sh genmock.sh