summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYuxuan 'fishy' Wang <yuxuan.wang@reddit.com>2022-10-28 10:29:25 -0700
committerYuxuan 'fishy' Wang <fishywang@gmail.com>2022-11-02 15:44:07 -0700
commite8353cb46e9f5e71f9b76f55d6bf59530b7f98ef (patch)
tree0a115e7b4edaf865c497a01196f9fc60acd8d734 /test
parent2acfe0fc7a1747c327da66c8a693840ba0c5a016 (diff)
downloadthrift-e8353cb46e9f5e71f9b76f55d6bf59530b7f98ef.tar.gz
Use multi-module to cleanup top level go.mod
Client: go The go library itself does not have any third-party dependencies. We have one third party dependency from the test code, which kind of polluted from top-level go.mod file to the users of thrift go library. We previous tried to clean that up by creating go.mod file at lib/go/thrift, which caused issues to the release process and thus reverted. Use multi-module to separate tests requiring mock to their own modules so that we can keep the top-level go.mod file clean. Also some minor fixes on the github actions go workflow.
Diffstat (limited to 'test')
-rw-r--r--test/go/Makefile.am16
-rw-r--r--test/go/genmock.sh4
-rw-r--r--test/go/go.mod17
-rw-r--r--test/go/go.sum29
4 files changed, 54 insertions, 12 deletions
diff --git a/test/go/Makefile.am b/test/go/Makefile.am
index abed92319..ff7ce683e 100644
--- a/test/go/Makefile.am
+++ b/test/go/Makefile.am
@@ -19,11 +19,7 @@
BUILT_SOURCES = gopath
-if GOVERSION_GE_118
-GOINSTALLEXTRA = -buildvcs=false
-else
-GOINSTALLEXTRA =
-endif
+GOBUILDEXTRA = -buildvcs=false
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
@@ -44,13 +40,13 @@ gopath: $(THRIFT) ThriftTest.thrift
touch gopath
bin/testclient: gopath
- GOPATH=`pwd` $(GO) install $(GOINSTALLEXTRA) -mod=mod ./src/bin/testclient
+ $(GO) build $(GOBUILDEXTRA) -o bin/testclient ./src/bin/testclient
bin/testserver: gopath
- GOPATH=`pwd` $(GO) install $(GOINSTALLEXTRA) -mod=mod ./src/bin/testserver
+ $(GO) build $(GOBUILDEXTRA) -o bin/testserver ./src/bin/testserver
bin/stress: gopath
- GOPATH=`pwd` $(GO) install $(GOINSTALLEXTRA) -mod=mod ./src/bin/stress
+ $(GO) build $(GOBUILDEXTRA) -o bin/stress ./src/bin/stress
clean-local:
$(RM) -r src/gen src/github.com/golang src/thrift bin pkg gopath ThriftTest.thrift
@@ -58,8 +54,8 @@ clean-local:
check_PROGRAMS: bin/testclient bin/testserver bin/stress
check: gopath genmock
- $(GO) test -mod=mod -v ./src/common/...
- $(GO) test -mod=mod -v ./src/gen/...
+ $(GO) test -v ./src/common/...
+ $(GO) test -v ./src/gen/...
genmock: gopath
sh genmock.sh
diff --git a/test/go/genmock.sh b/test/go/genmock.sh
index 9bd2a3ca7..687ce6142 100644
--- a/test/go/genmock.sh
+++ b/test/go/genmock.sh
@@ -4,8 +4,8 @@ set -e
export GOPATH=$(mktemp -d -t gopath-XXXXXXXXXX)
-go install -mod=mod github.com/golang/mock/mockgen
+go install github.com/golang/mock/mockgen
-`go env GOPATH`/bin/mockgen -build_flags "-mod=mod" -destination=src/common/mock_handler.go -package=common github.com/apache/thrift/test/go/src/gen/thrifttest ThriftTest
+`go env GOPATH`/bin/mockgen -destination=src/common/mock_handler.go -package=common github.com/apache/thrift/test/go/src/gen/thrifttest ThriftTest
chmod a+w -R $GOPATH && rm -Rf $GOPATH
diff --git a/test/go/go.mod b/test/go/go.mod
new file mode 100644
index 000000000..841c3291d
--- /dev/null
+++ b/test/go/go.mod
@@ -0,0 +1,17 @@
+module github.com/apache/thrift/test/go
+
+go 1.18
+
+require (
+ github.com/apache/thrift v0.0.0-00010101000000-000000000000
+ github.com/golang/mock v1.6.0
+)
+
+require (
+ golang.org/x/mod v0.4.2 // indirect
+ golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
+ golang.org/x/tools v0.1.1 // indirect
+ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
+)
+
+replace github.com/apache/thrift => ../../
diff --git a/test/go/go.sum b/test/go/go.sum
new file mode 100644
index 000000000..6904b3efe
--- /dev/null
+++ b/test/go/go.sum
@@ -0,0 +1,29 @@
+github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
+github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
+github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
+golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs=
+golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=