Update Go versions used in travis and LANGUAGES.md
Per our support policy, drop support of go 1.16 and add support of go
1.18.
Also enable go vet in make check, and fix issues reported by go vet.
diff --git a/lib/go/Makefile.am b/lib/go/Makefile.am
index d7f9b27..06399f5 100644
--- a/lib/go/Makefile.am
+++ b/lib/go/Makefile.am
@@ -23,6 +23,12 @@
SUBDIRS += test test/fuzz
endif
+if GOVERSION_GE_118
+GOBUILDEXTRA = -buildvcs=false
+else
+GOBUILDEXTRA =
+endif
+
install:
@echo '##############################################################'
@echo '##############################################################'
@@ -30,14 +36,17 @@
@echo '##############################################################'
@echo '##############################################################'
+# NOTE: We have to disable stdmethods in go vet until
+# https://github.com/golang/go/issues/52445 is fixed.
check-local:
+ $(GO) vet -mod=mod -stdmethods=false github.com/apache/thrift/lib/go/thrift
$(GO) test -mod=mod -race ./thrift
clean-local:
$(RM) -rf pkg
all-local:
- $(GO) build -mod=mod ./thrift
+ $(GO) build $(GOBUILDEXTRA) -mod=mod ./thrift
EXTRA_DIST = \
thrift \
diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am
index 2cca411..e1cf8cd 100644
--- a/lib/go/test/Makefile.am
+++ b/lib/go/test/Makefile.am
@@ -17,6 +17,12 @@
# under the License.
#
+if GOVERSION_GE_118
+GOBUILDEXTRA = -buildvcs=false
+else
+GOBUILDEXTRA =
+endif
+
THRIFTARGS = -out gopath/src/ --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift,package_prefix=github.com/apache/thrift/lib/go/test/gopath/src/$(COMPILER_EXTRAFLAG)
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
@@ -91,7 +97,7 @@
touch gopath
check: gopath
- $(GO) build -mod=mod \
+ $(GO) build $(GOBUILDEXTRA) -mod=mod \
./gopath/src/includestest \
./gopath/src/binarykeytest \
./gopath/src/servicestest \
diff --git a/lib/go/test/fuzz/Makefile.am b/lib/go/test/fuzz/Makefile.am
index 391c84a..a8a8102 100644
--- a/lib/go/test/fuzz/Makefile.am
+++ b/lib/go/test/fuzz/Makefile.am
@@ -33,4 +33,4 @@
fuzz.go \
fuzz_test.go \
go.mod \
- go.sum
+ go.sum
diff --git a/lib/go/thrift/binary_protocol.go b/lib/go/thrift/binary_protocol.go
index 3ed6608..c6fae0f 100644
--- a/lib/go/thrift/binary_protocol.go
+++ b/lib/go/thrift/binary_protocol.go
@@ -130,7 +130,6 @@
e = p.WriteI32(ctx, seqId)
return e
}
- return nil
}
func (p *TBinaryProtocol) WriteMessageEnd(ctx context.Context) error {
diff --git a/lib/go/thrift/protocol.go b/lib/go/thrift/protocol.go
index 8543b5f..647c0bd 100644
--- a/lib/go/thrift/protocol.go
+++ b/lib/go/thrift/protocol.go
@@ -180,5 +180,4 @@
default:
return NewTProtocolExceptionWithType(INVALID_DATA, fmt.Errorf("Unknown data type %d", fieldType))
}
- return nil
}
diff --git a/lib/go/thrift/serializer_test.go b/lib/go/thrift/serializer_test.go
index 9d785f9..78b6745 100644
--- a/lib/go/thrift/serializer_test.go
+++ b/lib/go/thrift/serializer_test.go
@@ -258,11 +258,13 @@
}
str, err := s.WriteString(context.Background(), &m)
if err != nil {
- t.Fatal("serialize:", err)
+ t.Error("serialize:", err)
+ return
}
var m1 MyTestStruct
if err = d.ReadString(context.Background(), &m1, str); err != nil {
- t.Fatal("deserialize:", err)
+ t.Error("deserialize:", err)
+ return
}